mirror of
https://github.com/m1k1o/neko.git
synced 2025-07-21 10:37:57 +02:00
clear cookie if non-existent session.
This commit is contained in:
parent
da1d073846
commit
bf6181764b
4 changed files with 13 additions and 16 deletions
|
@ -69,10 +69,12 @@ func (api *ApiManagerCtx) Authenticate(next http.Handler) http.Handler {
|
|||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
session, err := api.sessions.Authenticate(r)
|
||||
if err != nil {
|
||||
api.sessions.CookieClearToken(w, r)
|
||||
utils.HttpUnauthorized(w, err)
|
||||
} else {
|
||||
next.ServeHTTP(w, auth.SetSession(r, session))
|
||||
return
|
||||
}
|
||||
|
||||
next.ServeHTTP(w, auth.SetSession(r, session))
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue