From 3fed65af1772bf57b08bfd9eca5b81b8de94cf9e Mon Sep 17 00:00:00 2001 From: Arjan H Date: Sat, 6 Aug 2022 16:42:28 +0200 Subject: [PATCH] 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 --- gui/main.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/gui/main.go b/gui/main.go index 0a8d85e..43cf1b2 100644 --- a/gui/main.go +++ b/gui/main.go @@ -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