From aa099a54f3751f2496ab68c91fca16459b358c81 Mon Sep 17 00:00:00 2001 From: Anirudh Oppiliappan Date: Wed, 19 Feb 2025 22:23:15 +0200 Subject: [PATCH] appview: basic logout functionality This should be in the profile dropdown. --- appview/auth/auth.go | 6 ++++++ appview/pages/templates/layouts/topbar.html | 5 ++++- appview/state/state.go | 7 +++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/appview/auth/auth.go b/appview/auth/auth.go index 3d713d9..0c3df86 100644 --- a/appview/auth/auth.go +++ b/appview/auth/auth.go @@ -127,6 +127,12 @@ func (s *CreateSessionWrapper) GetStatus() *string { return s.Status } +func (a *Auth) ClearSession(r *http.Request, w http.ResponseWriter) error { + clientSession, _ := a.Store.Get(r, appview.SessionName) + clientSession.Options.MaxAge = -1 + return clientSession.Save(r, w) +} + func (a *Auth) StoreSession(r *http.Request, w http.ResponseWriter, atSessionish Sessionish, pdsEndpoint string) error { clientSession, _ := a.Store.Get(r, appview.SessionName) clientSession.Values[appview.SessionHandle] = atSessionish.GetHandle() diff --git a/appview/pages/templates/layouts/topbar.html b/appview/pages/templates/layouts/topbar.html index a478f3f..7f6d37b 100644 --- a/appview/pages/templates/layouts/topbar.html +++ b/appview/pages/templates/layouts/topbar.html @@ -1,6 +1,8 @@ {{ define "layouts/topbar" }} {{ with .LoggedInUser }} -