Commit aa27f82c authored by Stephane Glondu's avatar Stephane Glondu

Do not propose to update credentials when they were generated on server

parent c17f1540
......@@ -48,6 +48,7 @@ type auth_config = {
type metadata = {
?owner: user option;
?auth_config: auth_config list option;
?cred_authority : string option;
} <ocaml field_prefix="e_">
type datadir_item = {
......
......@@ -328,6 +328,7 @@ let () = Redirection.register ~service:election_setup_new
let se_metadata = {
e_owner = Some u;
e_auth_config = Some [{auth_system = "password"; auth_instance = "password"; auth_config = []}];
e_cred_authority = None;
} in
let question = {
q_answers = [| "Answer 1"; "Answer 2" |];
......@@ -663,6 +664,7 @@ let handle_credentials_post token creds =
Printf.ksprintf failwith "invalid credential at line %d" !i)
(Lwt_io.lines_of_file fname)
in
let () = se.se_metadata <- {se.se_metadata with e_cred_authority = None} in
T.generic_page ~title:"Success"
"Credentials have been received and checked!" () >>= Html5.send
......@@ -749,6 +751,9 @@ let () =
Any.register
~service:election_setup_credentials_server
(handle_setup (fun se () _ uuid ->
let () = se.se_metadata <- {se.se_metadata with
e_cred_authority = Some "server"
} in
let uuid_s = Uuidm.to_string uuid in
let title = se.se_questions.t_name in
let url = Eliom_uri.make_string_uri
......
......@@ -961,13 +961,20 @@ let election_admin w ~is_featured state () =
]
in
let uuid = W.election.e_params.e_uuid in
let update_credential =
match W.metadata.e_cred_authority with
| Some "server" ->
pcdata ""
| _ ->
div [
a ~service:election_update_credential [pcdata "Update a credential"] (uuid, ());
];
in
let content = [
div [
a ~service:Web_services.election_home [pcdata "Election home"] (uuid, ());
];
div [
a ~service:election_update_credential [pcdata "Update a credential"] (uuid, ());
];
update_credential;
div [
a ~service:election_dir [pcdata "Voter list"] (uuid, ESVoters);
];
......
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