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

Add smart ballot tracker to confirmation page

parent 9b9d6d6e
......@@ -436,9 +436,9 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct
end
| None -> fail_http 404
let ballot_received user =
let ballot_received user hash =
let can_vote = can_vote W.metadata user in
T.cast_confirmation (module W) ~can_vote ()
T.cast_confirmation (module W) ~can_vote hash ()
let election_cast =
(if_eligible can_read
......@@ -450,7 +450,7 @@ module Make (D : ELECTION_DATA) (P : WEB_PARAMS) : REGISTRABLE = struct
in
Eliom_reference.set Web_services.cont cont >>
match_lwt Eliom_reference.get ballot with
| Some _ -> ballot_received user >>= Html5.send
| Some b -> ballot_received user (sha256_b64 b) >>= Html5.send
| None -> T.cast_raw (module W) () >>= Html5.send
)
)
......
......@@ -831,7 +831,7 @@ let make_login_box style auth links =
lwt login_box = election_login_box w () in
base ~title:params.e_name ~login_box ~content
let cast_confirmation w ~can_vote () =
let cast_confirmation w ~can_vote hash () =
let module W = (val w : WEB_ELECTION_) in
lwt user = W.S.get_user () in
let params = W.election.e_params in
......@@ -839,7 +839,7 @@ let make_login_box style auth links =
let user_div = match user with
| Some u when can_vote ->
post_form ~service:election_cast_confirm (fun () -> [
div [
p ~a:[a_style "text-align: center; padding: 10px;"] [
pcdata "I am ";
format_user u;
pcdata " and ";
......@@ -868,7 +868,10 @@ let make_login_box style auth links =
p [
pcdata "Your ballot for ";
em [pcdata name];
pcdata " has been received, but not recorded yet.";
pcdata " has been received, but not recorded yet. ";
pcdata "Your smart ballot tracker is ";
b [pcdata hash];
pcdata ".";
];
user_div;
p [
......
......@@ -39,7 +39,7 @@ val election_home : (module WEB_ELECTION_) -> unit -> [> `Html ] Eliom_content.H
val election_admin : (module WEB_ELECTION_) -> is_featured:bool -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val update_credential : (module WEB_ELECTION_) -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val cast_raw : (module WEB_ELECTION_) -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val cast_confirmation : (module WEB_ELECTION_) -> can_vote:bool -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val cast_confirmation : (module WEB_ELECTION_) -> can_vote:bool -> string -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val cast_confirmed : (module WEB_ELECTION_) -> result:[< `Error of Web_common.error | `Valid of string ] -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val pretty_ballots : (module WEB_ELECTION_) -> string list -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
......
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