Commit 97e338b3 authored by Stephane Glondu's avatar Stephane Glondu

Warn the voter when she is going to revote

parent 50e460ff
......@@ -64,6 +64,7 @@ module type LocalizedStrings = sig
val your_ballot_for : string
val has_been_received : string
val nobody_can_see : string
val you_have_already_voted : string
val go_back_to_election : string
val has_been_accepted : string
val you_can_check_its_presence : string
......
......@@ -63,6 +63,7 @@ let please_login_to_confirm = "Bitte melden Sie sich an um Ihre Stime zu bestät
let your_ballot_for = "Ihre Stimme für "
let has_been_received = " wurde empfangen, aber noch nicht gespeichert. "
let nobody_can_see = "Hinweis: Ihre Stimme ist verschlüsselt und niemand kann ihren Inhalt sehen."
let you_have_already_voted = "Note: you have already voted. Your vote will be replaced."
let go_back_to_election = "Zurück zur Wahl"
let has_been_accepted = " wurde angenommen."
let you_can_check_its_presence = "Sie können jederzeit überprüfen, dass Ihre Stimme in der "
......
......@@ -63,6 +63,7 @@ let please_login_to_confirm = "Please log in to confirm your vote."
let your_ballot_for = "Your ballot for "
let has_been_received = " has been received, but not recorded yet. "
let nobody_can_see = "Note: your ballot is encrypted and nobody can see its contents."
let you_have_already_voted = "Note: you have already voted. Your vote will be replaced."
let go_back_to_election = "Go back to election"
let has_been_accepted = " has been accepted."
let you_can_check_its_presence = "You can check its presence in the "
......
......@@ -63,6 +63,7 @@ let please_login_to_confirm = "Veuillez vous connecter pour confirmer votre vote
let your_ballot_for = "Votre bulletin pour "
let has_been_received = " a été reçu, mais pas encore pris en compte. "
let nobody_can_see = "Note: votre bulletin est chiffré et personne ne peut voir son contenu."
let you_have_already_voted = "Note: vous avez déjà voté. Votre vote va être remplacé."
let go_back_to_election = "Retourner à la page d'accueil de l'élection"
let has_been_accepted = " a été accepté."
let you_can_check_its_presence = "Vous pouvez vérifier sa présence dans l'"
......
......@@ -63,6 +63,7 @@ let please_login_to_confirm = "La preghiamo di connettersi per confermare il suo
let your_ballot_for = "La sua scheda elettorale per "
let has_been_received = " è stata ricevuta, ma non è ancora presa in considerazione. "
let nobody_can_see = "Nota: la sua scheda è cifrata e nessuno può consultarla."
let you_have_already_voted = "Note: you have already voted. Your vote will be replaced."
let go_back_to_election = "Tornare alla pagina iniziale dell'elezione"
let has_been_accepted = " è stata accettata."
let you_can_check_its_presence = "È possibile verificare la sua presenza nell'"
......
......@@ -63,6 +63,7 @@ let please_login_to_confirm = "Vă rugăm să vă logați pentru a confirma votu
let your_ballot_for = "Buletinul de vot pentru "
let has_been_received = " a fost primit, dar nu a fost încă înregistrat. "
let nobody_can_see = "Notă: buletinul de vot este criptat și nimeni nu-i poate vedea conținutul."
let you_have_already_voted = "Note: you have already voted. Your vote will be replaced."
let go_back_to_election = "Întoarcete la pagina de start a alegerii"
let has_been_accepted = " a fost acceptat."
let you_can_check_its_presence = "Puteți verifica prezența în "
......
......@@ -204,3 +204,12 @@ let get_ballot_by_hash uuid hash =
let table = Ocsipersist.open_table ("ballots_" ^ underscorize uuid) in
try%lwt Ocsipersist.find table hash >>= (fun x -> return @@ Some x)
with Not_found -> return_none
let has_voted uuid user =
let uuid_u = underscorize uuid in
let records_table = Ocsipersist.open_table ("records_" ^ uuid_u) in
try%lwt
let%lwt _ = Ocsipersist.find records_table (string_of_user user) in
return true
with Not_found ->
return false
......@@ -57,3 +57,5 @@ val get_threshold : uuid -> string option Lwt.t
val get_ballot_hashes : uuid -> string list Lwt.t
val get_ballot_by_hash : uuid -> string -> string option Lwt.t
val has_voted : uuid -> user -> bool Lwt.t
......@@ -2047,6 +2047,16 @@ let cast_confirmation election hash () =
pcdata L.please_login_to_confirm;
]
in
let%lwt div_revote =
match user with
| None -> return @@ pcdata ""
| Some u ->
let%lwt revote = Web_persist.has_voted uuid u in
if revote then
return @@ p [b [pcdata L.you_have_already_voted]]
else
return @@ pcdata ""
in
let progress = div ~a:[a_style "text-align:center;margin-bottom:20px;"] [
pcdata L.input_credential;
pcdata " — ";
......@@ -2077,6 +2087,7 @@ let cast_confirmation election hash () =
];
br ();
p [pcdata L.nobody_can_see];
div_revote;
user_div;
p [
(let service =
......
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