1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

chore: set samesite attributes and configurable max age for cookies (resolve #75)

fix: sort entities by total time descending (resolve #74)
This commit is contained in:
Ferdinand Mütsch
2020-11-21 22:30:56 +01:00
parent f4328c452f
commit 4a78f66778
12 changed files with 308 additions and 250 deletions

View File

@ -58,7 +58,7 @@ func (m *AuthenticateMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Reques
if strings.HasPrefix(r.URL.Path, "/api") {
w.WriteHeader(http.StatusUnauthorized)
} else {
utils.ClearCookie(w, models.AuthCookieKey, !m.config.Security.InsecureCookies)
http.SetCookie(w, m.config.GetClearCookie(models.AuthCookieKey, "/"))
http.Redirect(w, r, fmt.Sprintf("%s/?error=unauthorized", m.config.Server.BasePath), http.StatusFound)
}
return