mirror of
https://github.com/outbackdingo/labca.git
synced 2026-01-27 10:19:34 +00:00
Keep setting the cookie so the expiration / max-age keeps renewing
Until now the session would expire 1 hour after the first action even when you keep using the gui in between
This commit is contained in:
@@ -2511,6 +2511,10 @@ func authorized(next http.Handler) http.Handler {
|
||||
} else {
|
||||
session, _ := sessionStore.Get(r, "labca")
|
||||
if session.Values["user"] != nil || (r.RequestURI == "/setup" && viper.Get("user.password") == nil) {
|
||||
// Keep setting the cookie so the expiration / max-age keeps renewing
|
||||
if err := session.Save(r, w); err != nil {
|
||||
log.Printf("cannot save session: %s\n", err)
|
||||
}
|
||||
next.ServeHTTP(w, r)
|
||||
} else {
|
||||
session.Values["bounce"] = r.RequestURI
|
||||
|
||||
Reference in New Issue
Block a user