hlfw.ca

webbing

Download patch

ref: d69d35a11f22a804fc4e06660b70039212e5bd24
parent: ba6890796a49f14426feb3c57f82fbda5f53c8c0
author: Michael Misch <michaelmisch1985@gmail.com>
date: Fri Nov 29 17:57:15 PST 2019

Alternative splash screen for login page when redirected

--- a/pages/login.go
+++ b/pages/login.go
@@ -20,11 +20,12 @@
 func login(p *message.Printer) map[string]interface{} {
 	// TODO: Also add in the error messages here
 	return map[string]interface{}{
-		"title":          p.Sprintf("Olmax Medical | Login"),
-		"greeting":       p.Sprintf("Welcome back!"),
-		"email":          p.Sprintf("Email:"),
-		"password":       p.Sprintf("Password:"),
-		"forgotPassword": p.Sprintf("Forgot your password?"),
-		"login":          p.Sprintf("Login"),
+		"title":          p.Sprint("Olmax Medical | Login"),
+		"continue":       p.Sprint("Please login to continue"),
+		"greeting":       p.Sprint("Welcome back!"),
+		"email":          p.Sprint("Email:"),
+		"password":       p.Sprint("Password:"),
+		"forgotPassword": p.Sprint("Forgot your password?"),
+		"login":          p.Sprint("Login"),
 	}
 }
--- a/router/pages.go
+++ b/router/pages.go
@@ -98,6 +98,9 @@
 	}
 	if p.session != nil {
 		r["username"] = p.session.Get("username")
+		if _, ok := p.session.Get("redirect").(string); ok {
+			r["redirect"] = true
+		}
 	}
 	return cache.render(r)
 }
--- a/templates/login.tpl
+++ b/templates/login.tpl
@@ -1,6 +1,6 @@
 {{define "content"}}
 	<main>
-            <h3>{{.greeting}}</h3>
+            <h3>{{if .redirect }}{{.continue}}{{else}}{{.greeting}}{{end}}</h3>
 	      {{range .errors}}
 	      <p style="color: red" class="errtext">{{.}}</p>
 	      {{end}}