Commit 31847b88 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Remove import of prepared election

parent c20e23a4
......@@ -34,7 +34,6 @@ let source_code = service ~path:["belenios.tar.gz"] ~get_params:unit ()
let get_randomness = service ~path:["get-randomness"] ~get_params:unit ()
let new_election = service ~path:["new-election"] ~get_params:unit ()
let new_election_post = post_service ~fallback:new_election ~post_params:(file "election" ** file "metadata" ** file "public_keys" ** file "public_creds") ()
let tool = preapply (static_dir ()) ["static"; "belenios-tool.html"]
......
......@@ -306,34 +306,6 @@ let () = Html5.register ~service:new_election
| Some _ -> T.new_election ()
)
let () = Any.register ~service:new_election_post
(fun () (election, (metadata, (public_keys, public_creds))) ->
match_lwt Web_auth_state.get_site_user () with
| Some u ->
let open Ocsigen_extensions in
let files = {
f_election = election.tmp_filename;
f_metadata = metadata.tmp_filename;
f_public_keys = public_keys.tmp_filename;
f_public_creds = public_creds.tmp_filename;
} in
begin try_lwt
begin match_lwt import_election files with
| None ->
T.new_election_failure `Exists () >>= Html5.send
| Some w ->
let module W = (val w : REGISTRABLE_ELECTION) in
lwt w = W.register () in
let module W = (val w : WEB_ELECTION) in
Redirection.send
(preapply election_admin (W.election.e_params.e_uuid, ()))
end
with e ->
T.new_election_failure (`Exception e) () >>= Html5.send
end
| None -> forbidden ()
)
let generate_uuid = Uuidm.v4_gen (Random.State.make_self_init ())
let () = Redirection.register ~service:election_setup_new
......
......@@ -199,35 +199,6 @@ let make_button ~service contents =
let new_election () =
let title = "Create new election" in
lwt body =
let form = post_form ~service:new_election_post
(fun (election, (metadata, (public_keys, public_creds))) ->
[
h2 [pcdata "Import prepared election"];
p [
pcdata "This section assumes you have already prepared election files offline using either the command-line tool or its ";
a ~service:tool [pcdata "web version"] ();
pcdata ".";
];
div [
pcdata "Public election parameters: ";
file_input ~name:election ();
];
div [
pcdata "Optional metadata: ";
file_input ~name:metadata ()
];
div [
pcdata "Trustee public keys: ";
file_input ~name:public_keys ()
];
div [
pcdata "Public credentials: ";
file_input ~name:public_creds ()
];
div [string_input ~input_type:`Submit ~value:"Submit" ()];
]
) ()
in
let setup_form = post_form ~service:election_setup_new
(fun () ->
[
......@@ -236,7 +207,7 @@ let new_election () =
]
) ()
in
return [form; setup_form]
return [setup_form]
in
let content = [
div body;
......
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