From 349fbb335c9c0c86b1f0ff35d97da180390121d6 Mon Sep 17 00:00:00 2001 From: jtricerolph Date: Wed, 22 Jul 2026 11:09:59 +0000 Subject: [PATCH] Fix logout (add missing nginx auth proxy) + show name/email in sidebar footer MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The /cashup/api/auth/ → central auth nginx block was missing, so the logout POST was hitting the app backend and returning 404 — cookie never cleared, user stayed logged in. Also removes the stale navigate('/login') call and shows name + email in the sidebar footer instead of name in the header. Co-Authored-By: Claude Sonnet 4.6 --- frontend/nginx.conf | 8 ++++++++ frontend/src/components/Layout.tsx | 11 ++++++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/frontend/nginx.conf b/frontend/nginx.conf index 6a02663..018e4e6 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -25,6 +25,14 @@ server { try_files $uri =404; } + location /cashup/api/auth/ { + proxy_pass http://10.10.10.101:3001/api/auth/; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + add_header Cache-Control "no-store"; + } + location /cashup/api/ { proxy_pass http://backend:3001/api/; proxy_set_header Host $host; diff --git a/frontend/src/components/Layout.tsx b/frontend/src/components/Layout.tsx index 461d0a0..725b1ed 100644 --- a/frontend/src/components/Layout.tsx +++ b/frontend/src/components/Layout.tsx @@ -1,5 +1,5 @@ import { useState, useEffect } from 'react' -import { NavLink, useNavigate, useLocation } from 'react-router-dom' +import { NavLink, useLocation } from 'react-router-dom' import { Banknote, ClipboardList, BarChart2, Wallet, Vault, FileText, Settings, LogOut, Menu, } from 'lucide-react' @@ -33,7 +33,6 @@ const navItems: { to: string; label: string; icon: typeof Banknote; cap?: Cashup ] export function Layout({ user, children }: Props) { - const navigate = useNavigate() const location = useLocation() const isMobile = useIsMobile() const [menuOpen, setMenuOpen] = useState(false) @@ -42,7 +41,6 @@ export function Layout({ user, children }: Props) { async function logout() { await fetch('/cashup/api/auth/logout', { method: 'POST', credentials: 'include' }) - navigate('/login', { replace: true }) window.location.reload() } @@ -62,7 +60,6 @@ export function Layout({ user, children }: Props) { Cash Up -

{user.name}

@@ -82,10 +79,14 @@ export function Layout({ user, children }: Props) {
+
+
{user.name}
+
{user.email}
+