From b41230db53faa7f95eacf65c8285c2e07bf08b6c Mon Sep 17 00:00:00 2001 From: "stirlingbot[bot]" <195170888+stirlingbot[bot]@users.noreply.github.com> Date: Mon, 11 Aug 2025 14:14:41 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20format=20everything=20with=20pre?= =?UTF-8?q?-commit=20by=20stirlingbot=20(#4175)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Auto-generated by [create-pull-request][1] with **stirlingbot** [1]: https://github.com/peter-evans/create-pull-request Signed-off-by: stirlingbot[bot] Co-authored-by: stirlingbot[bot] <195170888+stirlingbot[bot]@users.noreply.github.com> --- app/core/src/main/resources/static/js/fetch-utils.js | 11 +++++------ app/core/src/main/resources/static/js/jwt-init.js | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/app/core/src/main/resources/static/js/fetch-utils.js b/app/core/src/main/resources/static/js/fetch-utils.js index 2a2fe894c..2cccbd19d 100644 --- a/app/core/src/main/resources/static/js/fetch-utils.js +++ b/app/core/src/main/resources/static/js/fetch-utils.js @@ -1,12 +1,12 @@ // Authentication utility for cookie-based JWT window.JWTManager = { - + // Logout - clear cookies and redirect to login logout: function() { - + // Clear JWT cookie manually (fallback) document.cookie = 'stirling_jwt=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT; SameSite=None; Secure'; - + // Perform logout request to clear server-side session fetch('/logout', { method: 'POST', @@ -55,14 +55,13 @@ window.fetchWithCsrf = async function(url, options = {}) { // Make the request const response = await fetch(url, fetchOptions); - + // Handle 401 responses (unauthorized) if (response.status === 401) { console.warn('Authentication failed, redirecting to login'); window.JWTManager.logout(); return response; } - + return response; } - diff --git a/app/core/src/main/resources/static/js/jwt-init.js b/app/core/src/main/resources/static/js/jwt-init.js index 8cd63e189..35b736fd6 100644 --- a/app/core/src/main/resources/static/js/jwt-init.js +++ b/app/core/src/main/resources/static/js/jwt-init.js @@ -20,7 +20,7 @@ function initializeJWT() { // Clean up any JWT tokens from URL (OAuth flow) cleanupTokenFromUrl(); - + // Authentication is handled server-side // If user is not authenticated, server will redirect to login console.log('JWT initialization complete - authentication handled server-side'); @@ -41,4 +41,4 @@ } else { initializeJWT(); } -})(); \ No newline at end of file +})();