add login page customization
This commit is contained in:
@@ -8,13 +8,20 @@ import (
|
||||
|
||||
type LoginPageData struct {
|
||||
IsHiddenClassList string
|
||||
LoginData CustomizableLoginData
|
||||
}
|
||||
|
||||
type CustomizableLoginData struct {
|
||||
ServiceName string
|
||||
}
|
||||
|
||||
var LoginPageDataCustomizations CustomizableLoginData
|
||||
|
||||
func loginHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
tmpl := template.Must(template.ParseFiles("webserver/pages/login_page.html"))
|
||||
if r.Method == http.MethodGet {
|
||||
tmpl.Execute(w, LoginPageData{IsHiddenClassList: "hidden"})
|
||||
tmpl.Execute(w, LoginPageData{IsHiddenClassList: "hidden", LoginData: LoginPageDataCustomizations})
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<img id="logo_image" alt="logo" src="/logo" />
|
||||
<form id="login_card" class="card" method="POST">
|
||||
<div id="welcome_text">
|
||||
Welcome to Astral Tech, Please Sign in to your account below
|
||||
Welcome to {{.LoginData.ServiceName}}, Please Sign in to your account below
|
||||
</div>
|
||||
|
||||
<div class="error {{.IsHiddenClassList}}">
|
||||
|
||||
@@ -7,7 +7,8 @@ import (
|
||||
|
||||
var routes []string
|
||||
|
||||
func ServeLoginPage(route string) {
|
||||
func ServeLoginPage(route string, data CustomizableLoginData) {
|
||||
LoginPageDataCustomizations = data
|
||||
ServeWebpage(route, loginHandler)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user