From d2d15fc8f91b3477845bd69772a93c493e59930d Mon Sep 17 00:00:00 2001 From: Patrick Pfeiffer Date: Tue, 21 May 2024 13:11:55 +0200 Subject: [PATCH] (NOBIDS) frontend: invalidate old cookies --- handlers/auth.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/handlers/auth.go b/handlers/auth.go index 8bd99f8b21..284a857b91 100644 --- a/handlers/auth.go +++ b/handlers/auth.go @@ -183,6 +183,20 @@ func Login(w http.ResponseWriter, r *http.Request) { RedirectData: redirectData} data.Meta.NoTrack = true + if utils.Config.Frontend.SessionCookieDeriveDomainFromRequest { + // delete old cookie + // TODO:patrick delete this once all users have the new cookie + c := &http.Cookie{ + Name: utils.SessionStore.SCS.Cookie.Name, + Value: "", + Path: "/", + Expires: time.Unix(0, 0), + Domain: utils.SessionStore.SCS.Cookie.Domain, + HttpOnly: true, + } + http.SetCookie(w, c) + } + if handleTemplateError(w, r, "auth.go", "Login", "", loginTemplate.ExecuteTemplate(w, "layout", data)) != nil { return // an error has occurred and was processed }