mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 13:29:05 +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 := mux.NewRouter()
|
||||||
|
|
||||||
r.HandleFunc("/login", func(rw http.ResponseWriter, r *http.Request) {
|
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"})
|
templates.Render(rw, r, "login.tmpl", &templates.Page{Title: "Login"})
|
||||||
}).Methods(http.MethodGet)
|
}).Methods(http.MethodGet)
|
||||||
r.HandleFunc("/imprint", func(rw http.ResponseWriter, r *http.Request) {
|
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"})
|
templates.Render(rw, r, "imprint.tmpl", &templates.Page{Title: "Imprint"})
|
||||||
})
|
})
|
||||||
r.HandleFunc("/privacy", func(rw http.ResponseWriter, r *http.Request) {
|
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"})
|
templates.Render(rw, r, "privacy.tmpl", &templates.Page{Title: "Privacy"})
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -312,6 +315,7 @@ func main() {
|
|||||||
|
|
||||||
// On failure:
|
// On failure:
|
||||||
func(rw http.ResponseWriter, r *http.Request, err error) {
|
func(rw http.ResponseWriter, r *http.Request, err error) {
|
||||||
|
rw.Header().Add("Content-Type", "text/html; charset=utf-8")
|
||||||
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 - ClusterCockpit",
|
Title: "Login failed - ClusterCockpit",
|
||||||
@ -320,6 +324,7 @@ func main() {
|
|||||||
})).Methods(http.MethodPost)
|
})).Methods(http.MethodPost)
|
||||||
|
|
||||||
r.Handle("/logout", authentication.Logout(http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
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)
|
rw.WriteHeader(http.StatusOK)
|
||||||
templates.Render(rw, r, "login.tmpl", &templates.Page{
|
templates.Render(rw, r, "login.tmpl", &templates.Page{
|
||||||
Title: "Bye - ClusterCockpit",
|
Title: "Bye - ClusterCockpit",
|
||||||
|
Loading…
Reference in New Issue
Block a user