mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-10 08:57:25 +01:00
Remove separate Login struct in Page struct
This commit is contained in:
parent
9766bddb97
commit
c98863f22e
12
auth/auth.go
12
auth/auth.go
@ -192,9 +192,7 @@ func Login(db *sqlx.DB) http.Handler {
|
||||
rw.WriteHeader(http.StatusUnauthorized)
|
||||
templates.Render(rw, r, "login.tmpl", &templates.Page{
|
||||
Title: "Login failed",
|
||||
Login: &templates.LoginPage{
|
||||
Error: "Username or password incorrect",
|
||||
},
|
||||
Error: "Username or password incorrect",
|
||||
})
|
||||
return
|
||||
}
|
||||
@ -293,9 +291,7 @@ func Auth(next http.Handler) http.Handler {
|
||||
rw.WriteHeader(http.StatusUnauthorized)
|
||||
templates.Render(rw, r, "login.tmpl", &templates.Page{
|
||||
Title: "Authentication failed",
|
||||
Login: &templates.LoginPage{
|
||||
Error: "No valid session or JWT provided",
|
||||
},
|
||||
Error: "No valid session or JWT provided",
|
||||
})
|
||||
return
|
||||
}
|
||||
@ -351,8 +347,6 @@ func Logout(rw http.ResponseWriter, r *http.Request) {
|
||||
|
||||
templates.Render(rw, r, "login.tmpl", &templates.Page{
|
||||
Title: "Logout successful",
|
||||
Login: &templates.LoginPage{
|
||||
Info: "Logout successful",
|
||||
},
|
||||
Info: "Logout successful",
|
||||
})
|
||||
}
|
||||
|
@ -7,15 +7,15 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-4 mx-auto">
|
||||
{{if .Login.Error}}
|
||||
{{if .Error}}
|
||||
<div class="alert alert-warning" role="alert">
|
||||
{{.Login.Error}}
|
||||
{{.Error}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
{{if .Login.Info}}
|
||||
{{if .Info}}
|
||||
<div class="alert alert-success" role="alert">
|
||||
{{.Login.Info}}
|
||||
{{.Info}}
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user