Commit 3055f97a authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Make get_auth_systems return a monadic value

parent 9ef319af
......@@ -93,7 +93,7 @@ module Make (N : NAME) = struct
let auth_realm = N.name
let get_auth_systems () = !auth_instance_names
let get_auth_systems () = return !auth_instance_names
let get_user () =
match_lwt Eliom_reference.get user with
......
......@@ -29,7 +29,7 @@ module type AUTH_SERVICES = sig
val auth_realm : string
val get_auth_systems : unit -> string list
val get_auth_systems : unit -> string list Lwt.t
val get_user : unit -> user option Lwt.t
end
......
......@@ -3,4 +3,4 @@ open Web_serializable_t
(* Forward references filled in by Web_site_auth, needed by Web_templates *)
let get_user : (unit -> user option Lwt.t) ref = ref (fun () -> return None)
let get_auth_systems : (unit -> string list) ref = ref (fun () -> [])
let get_auth_systems : (unit -> string list Lwt.t) ref = ref (fun () -> return [])
......@@ -43,6 +43,7 @@ let make_login_box style auth links =
let module S = (val auth : AUTH_SERVICES) in
let module L = (val links : AUTH_LINKS) in
lwt user = S.get_user () in
lwt auth_systems = S.get_auth_systems () in
return @@ div ~a:[a_style style] (
match user with
| Some user ->
......@@ -63,7 +64,7 @@ let make_login_box style auth links =
pcdata "Not logged in.";
];
let auth_systems =
S.get_auth_systems () |>
auth_systems |>
List.map (fun name ->
a ~service:(L.login (Some name)) [pcdata name] ()
) |> list_join (pcdata ", ")
......@@ -1160,8 +1161,9 @@ let upload_password_db ~service auth links () =
let choose auth links () =
let module S = (val auth : AUTH_SERVICES) in
let module L = (val links : AUTH_LINKS) in
lwt auth_systems = S.get_auth_systems () in
let auth_systems =
S.get_auth_systems () |>
auth_systems |>
List.map (fun name ->
a ~service:(L.login (Some name)) [pcdata name] ()
) |> list_join (pcdata ", ")
......
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