Une MAJ de sécurité est nécessaire sur notre version actuelle. Elle sera effectuée lundi 02/08 entre 12h30 et 13h. L'interruption de service devrait durer quelques minutes (probablement moins de 5 minutes).

Commit e18b0be1 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Use voter list in credential generation

parent 83942945
......@@ -25,8 +25,16 @@ open Tool_js_common
open Tool_credgen
let generate _ =
let number = get_input "number" |> int_of_string in
let ids = generate_ids number in
let ids =
let raw = get_textarea "voters" in
let rec loop i accu =
if i >= 0 then
let j = try String.rindex_from raw i '\n' with Not_found -> -1 in
loop (j-1) (String.sub raw (j+1) (i-j) :: accu)
else
accu
in loop (String.length raw - 1) []
in
let module P : PARAMS = struct
let uuid = get_textarea "uuid"
let group = get_textarea "group"
......@@ -56,12 +64,6 @@ let fill_interactivity _ =
(document##getElementById (Js.string "interactivity"))
(fun e ->
let x = document##createElement (Js.string "div") in
let t = document##createTextNode (Js.string "Number of credentials to generate: ") in
Dom.appendChild x t;
let y = document##createElement (Js.string "input") in
y##setAttribute (Js.string "id", Js.string "number");
y##setAttribute (Js.string "size", Js.string "5");
Dom.appendChild x y;
Dom.appendChild e x;
let b = document##createElement (Js.string "button") in
let t = document##createTextNode (Js.string "Generate") in
......
......@@ -476,6 +476,14 @@ let election_setup_credentials token uuid se () =
div [textarea ~a:[a_id "group"; a_rows 5; a_cols 40; a_readonly `ReadOnly] ~name ~value ()];
]
in
let voters =
let name : 'a Eliom_parameter.param_name = Obj.magic "voters" in
let value = String.concat "\n" se.se_voters in
div [
div [pcdata "List of voters:"];
div [textarea ~a:[a_id "voters"; a_rows 5; a_cols 40; a_readonly `ReadOnly] ~name ~value ()];
]
in
let interactivity =
div
~a:[a_id "interactivity"]
......@@ -487,7 +495,7 @@ let election_setup_credentials token uuid se () =
script ~a:[a_src (uri_of_string (fun () -> "../static/tool_js_credgen.js"))] (pcdata "");
]
in
let div_textarea = div [group; interactivity; form_textarea; disclaimer] in
let div_textarea = div [group; voters; interactivity; form_textarea; disclaimer] in
let content = [
div_download;
div_textarea;
......
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