mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-11-10 08:57:25 +01:00
Add content-type header to logout (issue #19)
This commit is contained in:
parent
65f7e5e6c8
commit
3474ead49b
@ -292,12 +292,15 @@ func main() {
|
||||
r := mux.NewRouter()
|
||||
|
||||
r.HandleFunc("/login", func(rw http.ResponseWriter, r *http.Request) {
|
||||
rw.Header().Add("Content-Type", "text/html; charset=utf-8")
|
||||
templates.Render(rw, r, "login.tmpl", &templates.Page{Title: "Login"})
|
||||
}).Methods(http.MethodGet)
|
||||
r.HandleFunc("/imprint", func(rw http.ResponseWriter, r *http.Request) {
|
||||
rw.Header().Add("Content-Type", "text/html; charset=utf-8")
|
||||
templates.Render(rw, r, "imprint.tmpl", &templates.Page{Title: "Imprint"})
|
||||
})
|
||||
r.HandleFunc("/privacy", func(rw http.ResponseWriter, r *http.Request) {
|
||||
rw.Header().Add("Content-Type", "text/html; charset=utf-8")
|
||||
templates.Render(rw, r, "privacy.tmpl", &templates.Page{Title: "Privacy"})
|
||||
})
|
||||
|
||||
@ -312,6 +315,7 @@ func main() {
|
||||
|
||||
// On failure:
|
||||
func(rw http.ResponseWriter, r *http.Request, err error) {
|
||||
rw.Header().Add("Content-Type", "text/html; charset=utf-8")
|
||||
rw.WriteHeader(http.StatusUnauthorized)
|
||||
templates.Render(rw, r, "login.tmpl", &templates.Page{
|
||||
Title: "Login failed - ClusterCockpit",
|
||||
@ -320,6 +324,7 @@ func main() {
|
||||
})).Methods(http.MethodPost)
|
||||
|
||||
r.Handle("/logout", authentication.Logout(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||
rw.Header().Add("Content-Type", "text/html; charset=utf-8")
|
||||
rw.WriteHeader(http.StatusOK)
|
||||
templates.Render(rw, r, "login.tmpl", &templates.Page{
|
||||
Title: "Bye - ClusterCockpit",
|
||||
|
Loading…
Reference in New Issue
Block a user