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

Export logout handler

parent 4f69f0b2
......@@ -86,6 +86,17 @@ module Make (N : CONFIG) = struct
~get_params:Eliom_parameter.unit
()
let do_logout cont () =
match_lwt Eliom_reference.get user with
| Some u ->
security_log (fun () ->
string_of_user u.user_user ^ " logged out"
) >>
Eliom_reference.unset user >>
let module A = (val u.user_handlers) in
A.logout cont ()
| None -> cont () ()
end
module Register (C : CONT_SERVICE) (T : TEMPLATES) : EMPTY = struct
......@@ -147,21 +158,9 @@ module Make (N : CONFIG) = struct
let () = Eliom_registration.Any.register
~service:Services.logout
(fun () () ->
lwt u = Eliom_reference.get user in
(* should ballot be unset here or not? *)
Eliom_reference.unset user >>
match u with
| Some u ->
security_log (fun () ->
string_of_user u.user_user ^ " logged out"
) >>
let module A = (val u.user_handlers) in
let cont () () =
C.cont () >>= Eliom_registration.Redirection.send
in
A.logout cont ()
| _ ->
let cont () () =
C.cont () >>= Eliom_registration.Redirection.send
in Services.do_logout cont ()
)
end
......
......@@ -204,6 +204,8 @@ module type AUTH_SERVICES = sig
[< Eliom_service.registrable > `Registrable ], 'a)
Eliom_service.service
val do_logout : unit service_cont
end
module type WEB_BALLOT_BOX = sig
......
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