From 880425b33525e0227cc4de7dcc2ee7ec1e590850 Mon Sep 17 00:00:00 2001 From: Accusys Date: Mon, 18 May 2026 12:20:49 +0800 Subject: [PATCH] fix: logout clears cookies + shows login form, module-list clear on re-login --- docs_v1.0/doc_wasm/index.html | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs_v1.0/doc_wasm/index.html b/docs_v1.0/doc_wasm/index.html index 5afba60..27bde6e 100644 --- a/docs_v1.0/doc_wasm/index.html +++ b/docs_v1.0/doc_wasm/index.html @@ -168,6 +168,7 @@ async function initApp() { await initWasm(); el.innerHTML = '

Building modules...

'; var listEl = document.getElementById('module-list'); + listEl.innerHTML = ''; MODULES.forEach(function(m) { var a = document.createElement('a'); a.className = 'module-link'; @@ -193,10 +194,14 @@ async function initApp() { e.preventDefault(); e.stopPropagation(); try { - await fetch('/api/v1/auth/logout', {method:'POST'}); + await fetch('/api/v1/auth/logout', {method:'POST', credentials:'include'}); } catch(_) {} - el.innerHTML = '

Logged out. Session cleared.

'; - document.getElementById('logout-btn').style.display = 'none'; + // Clear client-side cookies + document.cookie.split(';').forEach(function(c) { + document.cookie = c.trim().split('=')[0] + '=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'; + }); + document.getElementById('sidebar').style.display = 'none'; + showLoginForm(); }; // Load initial module from hash or default