From 639c12e7a8b37707da96a46ea8c5d290590942e5 Mon Sep 17 00:00:00 2001 From: Jack Bonatakis Date: Thu, 19 Mar 2026 19:43:53 -0400 Subject: [PATCH] Render logout as a POST form In order to make the logout link send a POST we have to render it as a button. This does that, and styles it to match the existing links in the sidebar --- media/css/main.css | 15 +++++++++++++++ pgweb/util/contexts.py | 2 +- templates/base/page.html | 10 +++++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/media/css/main.css b/media/css/main.css index 6aed61e0..b6f0ee79 100644 --- a/media/css/main.css +++ b/media/css/main.css @@ -848,6 +848,21 @@ input#navbar-toggler { font-weight: normal; } +#pgSideNav .pg-nav-button { + background: none; + border: 0; + color: var(--pg-sidenav-a-fg-color); + cursor: pointer; + font: inherit; + font-weight: normal; + padding: 0; +} + +#pgSideNav .pg-nav-button:hover, +#pgSideNav .pg-nav-button:active { + color: var(--a-highlight-fg-color); +} + #pgSideNav ul { list-style-type: circle; padding-left: 1.3em; diff --git a/pgweb/util/contexts.py b/pgweb/util/contexts.py index 412b7b61..189bea59 100644 --- a/pgweb/util/contexts.py +++ b/pgweb/util/contexts.py @@ -87,7 +87,7 @@ sitenav = { {'title': 'Organisations', 'link': '/account/edit/organisations/'}, ]}, {'title': 'Change password', 'link': '/account/changepwd/'}, - {'title': 'Logout', 'link': '/account/logout/'}, + {'title': 'Logout', 'link': '/account/logout/', 'post': True}, ], } diff --git a/templates/base/page.html b/templates/base/page.html index 523b53d8..0548912d 100644 --- a/templates/base/page.html +++ b/templates/base/page.html @@ -11,7 +11,15 @@