mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2024-12-26 05:19:05 +01:00
Reformat and add debug output
This commit is contained in:
parent
734e818b19
commit
3028f60807
@ -342,6 +342,7 @@ func main() {
|
|||||||
// Those should be mounted to this subrouter. If authentication is enabled, a middleware will prevent
|
// Those should be mounted to this subrouter. If authentication is enabled, a middleware will prevent
|
||||||
// any unauthenticated accesses.
|
// any unauthenticated accesses.
|
||||||
secured := r.PathPrefix("/").Subrouter()
|
secured := r.PathPrefix("/").Subrouter()
|
||||||
|
|
||||||
if !config.Keys.DisableAuthentication {
|
if !config.Keys.DisableAuthentication {
|
||||||
r.Handle("/login", authentication.Login(
|
r.Handle("/login", authentication.Login(
|
||||||
// On success:
|
// On success:
|
||||||
@ -359,16 +360,17 @@ 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(
|
||||||
rw.Header().Add("Content-Type", "text/html; charset=utf-8")
|
http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {
|
||||||
rw.WriteHeader(http.StatusOK)
|
rw.Header().Add("Content-Type", "text/html; charset=utf-8")
|
||||||
web.RenderTemplate(rw, "login.tmpl", &web.Page{
|
rw.WriteHeader(http.StatusOK)
|
||||||
Title: "Bye - ClusterCockpit",
|
web.RenderTemplate(rw, "login.tmpl", &web.Page{
|
||||||
MsgType: "alert-info",
|
Title: "Bye - ClusterCockpit",
|
||||||
Message: "Logout successful",
|
MsgType: "alert-info",
|
||||||
Build: buildInfo,
|
Message: "Logout successful",
|
||||||
})
|
Build: buildInfo,
|
||||||
}))).Methods(http.MethodPost)
|
})
|
||||||
|
}))).Methods(http.MethodPost)
|
||||||
|
|
||||||
secured.Use(func(next http.Handler) http.Handler {
|
secured.Use(func(next http.Handler) http.Handler {
|
||||||
return authentication.Auth(
|
return authentication.Auth(
|
||||||
|
@ -168,6 +168,8 @@ func (auth *Authentication) Login(
|
|||||||
var user *schema.User
|
var user *schema.User
|
||||||
if user, ok = authenticator.CanLogin(dbUser, username, rw, r); !ok {
|
if user, ok = authenticator.CanLogin(dbUser, username, rw, r); !ok {
|
||||||
continue
|
continue
|
||||||
|
} else {
|
||||||
|
log.Debugf("Can login with user %v", user)
|
||||||
}
|
}
|
||||||
|
|
||||||
user, err := authenticator.Login(user, rw, r)
|
user, err := authenticator.Login(user, rw, r)
|
||||||
|
Loading…
Reference in New Issue
Block a user