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

Generic page, not only for errors

parent e24c3bf0
......@@ -397,7 +397,7 @@ let handle_setup f cont uuid x =
Ocsipersist.add election_stable uuid_s se >>
Redirection.send (preapply cont uuid)
with e ->
T.generic_error_page (Printexc.to_string e) () >>= Html5.send
T.generic_page ~title:"Error" (Printexc.to_string e) () >>= Html5.send
) else forbidden ()
)
| None -> forbidden ()
......@@ -483,7 +483,7 @@ let () =
let wrap_handler f =
try_lwt f ()
with
| e -> T.generic_error_page (Printexc.to_string e) () >>= Html5.send
| e -> T.generic_page ~title:"Error" (Printexc.to_string e) () >>= Html5.send
let handle_credentials_post token creds =
lwt uuid = Ocsipersist.find election_credtokens token in
......@@ -990,7 +990,7 @@ let () =
in
lwt pds = Web_persist.get_partial_decryptions uuid_s in
if List.mem_assoc trustee_id pds then (
T.generic_error_page
T.generic_page ~title:"Error"
"Your partial decryption has already been received and checked!"
() >>= Html5.send
) else (
......@@ -1035,11 +1035,11 @@ let () =
if W.E.check_factor et pk pd then (
let pds = (trustee_id, partial_decryption) :: pds in
lwt () = Web_persist.set_partial_decryptions uuid_s pds in
T.generic_error_page
T.generic_page ~title:"Success"
"Your partial decryption has been received and checked!" () >>=
Html5.send
) else (
T.generic_error_page
T.generic_page ~title:"Error"
"The partial decryption didn't pass validation!" () >>=
Html5.send
))
......
......@@ -261,8 +261,7 @@ let election_setup_index uuids auth () =
lwt login_box = site_login_box auth () in
base ~title ~login_box ~content ()
let generic_error_page message () =
let title = "Error" in
let generic_page ~title message () =
let content = [
p [pcdata message];
] in
......
......@@ -27,7 +27,7 @@ val admin : elections:(module WEB_ELECTION) list -> (module AUTH_SERVICES) -> un
val new_election : (module AUTH_SERVICES) -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val new_election_failure : [ `Exists | `Exception of exn ] -> (module AUTH_SERVICES) -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val generic_error_page : string -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val generic_page : title:string -> string -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup_index : Uuidm.t list -> (module AUTH_SERVICES) -> unit -> [> `Html ] Eliom_content.Html5.F.elt Lwt.t
val election_setup : Uuidm.t -> Web_common.setup_election -> (module AUTH_SERVICES) -> 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