Commit 80257c9d authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Add function underscorize

parent e8fdeb64
......@@ -238,3 +238,6 @@ let generate_token () =
let string_of_user {user_domain; user_name} =
user_domain ^ ":" ^ user_name
let underscorize x =
String.map (function '-' -> '_' | c -> c) x
......@@ -108,3 +108,5 @@ type setup_election = {
val generate_token : unit -> string Lwt.t
val string_of_user : user -> string
val underscorize : string -> string
......@@ -43,10 +43,7 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : WEB_ELECTION = struct
module B : WEB_BALLOT_BOX = struct
let suffix = "_" ^ String.map (function
| '-' -> '_'
| c -> c
) uuid
let suffix = "_" ^ underscorize uuid
module Ballots = struct
type 'a m = 'a Lwt.t
......
......@@ -97,9 +97,7 @@ let password_handler () (name, password) =
| None -> "site"
| Some u ->
let u = Uuidm.to_string u in
for i = 0 to String.length u - 1 do
if u.[i] = '-' then u.[i] <- '_'
done; u
underscorize u
in
let table = Ocsipersist.open_table table in
lwt salt, hashed =
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment