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 642ca432 authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Use result type for cast_confirmed

parent 08c87e6a
Pipeline #55178 passed with stages
in 17 minutes and 47 seconds
......@@ -1466,8 +1466,8 @@ let () =
let%lwt result =
try%lwt
let%lwt hash = cast_ballot uuid ~rawballot ~user in
return (`Valid hash)
with BeleniosWebError e -> return (`Error e)
return (Ok hash)
with BeleniosWebError e -> return (Error e)
in
let%lwt () = Eliom_reference.set Web_state.cast_confirmed (Some result) in
redir_preapply election_home (uuid, ()) ()
......
......@@ -28,7 +28,7 @@ val election_user : (uuid * user) option Eliom_reference.eref
val get_election_user : uuid -> user option Lwt.t
val ballot : string option Eliom_reference.eref
val cast_confirmed : [ `Error of Web_common.error | `Valid of string ] option Eliom_reference.eref
val cast_confirmed : (string, Web_common.error) result option Eliom_reference.eref
val language : string Eliom_reference.eref
......
......@@ -2252,7 +2252,7 @@ let cast_confirmed election ~result () =
] in
let result, step_title =
match result with
| `Valid hash ->
| Ok hash ->
[pcdata L.has_been_accepted;
pcdata " ";
pcdata L.your_tracker_is;
......@@ -2265,7 +2265,7 @@ let cast_confirmed election ~result () =
pcdata L.anytime_during_the_election;
pcdata L.confirmation_email;
], L.thank_you_for_voting
| `Error e ->
| Error e ->
[pcdata L.is_rejected_because;
pcdata (Web_common.explain_error l e);
pcdata ".";
......
......@@ -57,7 +57,7 @@ val update_credential : 'a election -> unit -> [> `Html ] Eliom_content.Html.F.e
val regenpwd : uuid -> unit -> [> `Html ] Eliom_content.Html.F.elt Lwt.t
val cast_raw : 'a election -> unit -> [> `Html ] Eliom_content.Html.F.elt Lwt.t
val cast_confirmation : 'a election -> string -> unit -> [> `Html ] Eliom_content.Html.F.elt Lwt.t
val cast_confirmed : 'a election -> result:[< `Error of Web_common.error | `Valid of string ] -> unit -> [> `Html ] Eliom_content.Html.F.elt Lwt.t
val cast_confirmed : 'a election -> result:(string, Web_common.error) result -> unit -> [> `Html ] Eliom_content.Html.F.elt Lwt.t
val pretty_ballots : 'a election -> string list -> Yojson.Safe.json election_result option -> unit -> [> `Html ] Eliom_content.Html.F.elt Lwt.t
val pretty_records : 'a election -> (string * string) list -> unit -> [> `Html ] Eliom_content.Html.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