From b8ef5107deaf5763ae55e7045170fef80e8030fd Mon Sep 17 00:00:00 2001 From: Jehiah Czebotar Date: Sun, 9 Nov 2014 00:26:52 -0500 Subject: [PATCH] pretty styling of sign in page --- main.go | 6 +++- templates.go | 100 +++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 91 insertions(+), 15 deletions(-) diff --git a/main.go b/main.go index 73a84ac..5cf72df 100644 --- a/main.go +++ b/main.go @@ -86,7 +86,11 @@ func main() { oauthproxy := NewOauthProxy(upstreamUrls, *clientID, *clientSecret, validator) oauthproxy.SetRedirectUrl(redirectUrl) if len(googleAppsDomains) != 0 && *authenticatedEmailsFile == "" { - oauthproxy.SignInMessage = fmt.Sprintf("using a email address from the following domains: %v", strings.Join(googleAppsDomains, ", ")) + if len(googleAppsDomains) > 1 { + oauthproxy.SignInMessage = fmt.Sprintf("Authenticate using one of the following domains: %v", strings.Join(googleAppsDomains, ", ")) + } else { + oauthproxy.SignInMessage = fmt.Sprintf("Authenticate using %v", googleAppsDomains[0]) + } } if *htpasswdFile != "" { oauthproxy.HtpasswdFile, err = NewHtpasswdFromFile(*htpasswdFile) diff --git a/templates.go b/templates.go index a0e2a91..7d29c40 100644 --- a/templates.go +++ b/templates.go @@ -9,26 +9,95 @@ func getTemplates() *template.Template { t, err := template.New("foo").Parse(`{{define "sign_in.html"}} -Sign In - - - + + Sign In + + +
- - {{.SignInMessage}} + {{ if .SignInMessage }} +

{{.SignInMessage}}

+ {{ end}} +
+
+ {{ if .Htpasswd }} -
-
+
+
+
+ + + {{ end }} @@ -40,7 +109,10 @@ func getTemplates() *template.Template { t, err = t.Parse(`{{define "error.html"}} -{{.Title}} + + {{.Title}} + +

{{.Title}}

{{.Message}}