From 595d902dcdba71365ffd55fd53188cb97b400873 Mon Sep 17 00:00:00 2001 From: Trong Huu Nguyen Date: Wed, 20 Jul 2022 15:56:17 +0200 Subject: [PATCH] fix(handler/default): only assert loginstatus if we already have an active session --- pkg/handler/handler_default.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkg/handler/handler_default.go b/pkg/handler/handler_default.go index e0bf137..9cb2338 100644 --- a/pkg/handler/handler_default.go +++ b/pkg/handler/handler_default.go @@ -19,12 +19,12 @@ func (h *Handler) Default(w http.ResponseWriter, r *http.Request) { if hasAccessToken { // add authentication if session cookie and token checks out isAuthenticated = true - } - // force new authentication if loginstatus is enabled and cookie isn't set - if h.Loginstatus.NeedsLogin(r) { - isAuthenticated = false - logentry.LogEntry(r).Info("default: loginstatus was enabled, but no matching cookie was found; state is now unauthenticated") + // force new authentication if loginstatus is enabled and cookie isn't set + if h.Loginstatus.NeedsLogin(r) { + isAuthenticated = false + logentry.LogEntry(r).Info("default: loginstatus was enabled, but no matching cookie was found; state is now unauthenticated") + } } if h.AutoLogin.NeedsLogin(r, isAuthenticated) {