Commit 66b2498a authored by Stephane Glondu's avatar Stephane Glondu
Browse files

Add a visual indication of what kind of login_box is shown

parent b2ebd810
......@@ -83,6 +83,8 @@ module Make (N : CONFIG) = struct
module Services : AUTH_SERVICES = struct
let auth_realm = N.name
let get_auth_systems () = !auth_instance_names
let get_user () =
......
......@@ -41,6 +41,8 @@ type election_config = {
module type AUTH_SERVICES = sig
val auth_realm : string
val get_auth_systems : unit -> string list
val get_user : unit -> user option Lwt.t
......
......@@ -32,14 +32,16 @@ open Eliom_content.Html5.F
let site_title = "Election Server"
let welcome_message = "Welcome!"
let admin_background = " background: #FF9999;"
let format_user u =
em [pcdata (Web_auth.(string_of_user u))]
let make_login_box auth =
let make_login_box style auth =
let style = "float: right; text-align: right;" ^ style in
let module S = (val auth : AUTH_SERVICES) in
lwt user = S.get_user () in
return @@ div ~a:[a_style "float: right; text-align: right;"] (
return @@ div ~a:[a_style style] (
match user with
| Some user ->
[
......@@ -74,7 +76,7 @@ module Make (S : SITE_SERVICES) : TEMPLATES = struct
let site_login_box =
let auth = (module S : AUTH_SERVICES) in
fun () -> make_login_box auth
fun () -> make_login_box admin_background auth
let base ~title ~login_box ~content =
Lwt.return (html ~a:[a_dir `Ltr; a_xml_lang "en"]
......@@ -134,7 +136,10 @@ module Make (S : SITE_SERVICES) : TEMPLATES = struct
let login_box =
let auth = (module S : AUTH_SERVICES) in
fun () -> make_login_box auth
let style =
if S.auth_realm = "site" then admin_background else ""
in
fun () -> make_login_box style auth
let dummy ~service () =
let title, field_name, input_type =
......@@ -211,7 +216,7 @@ module Make (S : SITE_SERVICES) : TEMPLATES = struct
let election_login_box =
let auth = (module W.S : AUTH_SERVICES) in
fun () -> make_login_box auth
fun () -> make_login_box "" auth
let file x = Eliom_service.preapply W.S.election_dir x
......
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