From d9a0a4d0fae8627b3d0a1bab5ab034666d3c8e00 Mon Sep 17 00:00:00 2001 From: Denis Gukov Date: Sat, 26 Aug 2023 13:16:25 +0200 Subject: [PATCH] fix(be): do not expire session for demo mode --- api/auth.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/auth.go b/api/auth.go index 4a7082190..e7a42731f 100644 --- a/api/auth.go +++ b/api/auth.go @@ -61,7 +61,7 @@ func authenticationHandler(w http.ResponseWriter, r *http.Request) bool { return false } - if time.Since(session.LastActive).Hours() > 7*24 { + if time.Since(session.LastActive).Hours() > 7*24 && !util.Config.DemoMode { // more than week old unused session // destroy. if err := helpers.Store(r).ExpireSession(userID, sessionID); err != nil { @@ -119,7 +119,7 @@ func authenticationWithStore(next http.Handler) http.Handler { store := helpers.Store(r) var ok bool - + db.StoreSession(store, r.URL.String(), func() { ok = authenticationHandler(w, r) })