mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-13 02:17: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)
|
rw.WriteHeader(http.StatusUnauthorized)
|
||||||
templates.Render(rw, r, "login.tmpl", &templates.Page{
|
templates.Render(rw, r, "login.tmpl", &templates.Page{
|
||||||
Title: "Login failed",
|
Title: "Login failed",
|
||||||
Login: &templates.LoginPage{
|
Error: "Username or password incorrect",
|
||||||
Error: "Username or password incorrect",
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -293,9 +291,7 @@ func Auth(next http.Handler) http.Handler {
|
|||||||
rw.WriteHeader(http.StatusUnauthorized)
|
rw.WriteHeader(http.StatusUnauthorized)
|
||||||
templates.Render(rw, r, "login.tmpl", &templates.Page{
|
templates.Render(rw, r, "login.tmpl", &templates.Page{
|
||||||
Title: "Authentication failed",
|
Title: "Authentication failed",
|
||||||
Login: &templates.LoginPage{
|
Error: "No valid session or JWT provided",
|
||||||
Error: "No valid session or JWT provided",
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -351,8 +347,6 @@ func Logout(rw http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
templates.Render(rw, r, "login.tmpl", &templates.Page{
|
templates.Render(rw, r, "login.tmpl", &templates.Page{
|
||||||
Title: "Logout successful",
|
Title: "Logout successful",
|
||||||
Login: &templates.LoginPage{
|
Info: "Logout successful",
|
||||||
Info: "Logout successful",
|
|
||||||
},
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -7,15 +7,15 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-4 mx-auto">
|
<div class="col-4 mx-auto">
|
||||||
{{if .Login.Error}}
|
{{if .Error}}
|
||||||
<div class="alert alert-warning" role="alert">
|
<div class="alert alert-warning" role="alert">
|
||||||
{{.Login.Error}}
|
{{.Error}}
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{if .Login.Info}}
|
{{if .Info}}
|
||||||
<div class="alert alert-success" role="alert">
|
<div class="alert alert-success" role="alert">
|
||||||
{{.Login.Info}}
|
{{.Info}}
|
||||||
</div>
|
</div>
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user