From 3cf1c33b69d313d6187b41c4b5af69035e001f62 Mon Sep 17 00:00:00 2001 From: bruno Date: Fri, 24 Jul 2026 09:36:23 -0400 Subject: [PATCH] fix: remove confirm() dialogs from both logout buttons MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Header logout (#logout-btn) already had no confirm (AuthManager.logout called directly) - Settings panel (#logout-btn + #profile-logout) now call handleLogout() without confirm - Both buttons redirect to login screen immediately — consistent behavior --- frontend/js/config.js | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/frontend/js/config.js b/frontend/js/config.js index 02e4664..7e4b7b1 100644 --- a/frontend/js/config.js +++ b/frontend/js/config.js @@ -631,17 +631,15 @@ function initConfigModal() { }); } - // Logout button (always visible) — delegates to global handleLogout for proper session cleanup + // Logout button (always visible) — delegates to global handleLogout (no confirm) var logoutBtn = document.getElementById("logout-btn"); if (logoutBtn) { logoutBtn.addEventListener("click", function() { - if (confirm(t('confirm.logout') || "Voulez-vous vraiment vous deconnecter ?")) { - if (typeof window.handleLogout === 'function') { - window.handleLogout(); - } else { - fetch('/api/auth/logout', { method: 'POST', credentials: 'include' }) - .finally(function() { window.location.href = '/'; }); - } + if (typeof window.handleLogout === 'function') { + window.handleLogout(); + } else { + fetch('/api/auth/logout', { method: 'POST', credentials: 'include' }) + .finally(function() { window.location.href = '/'; }); } }); } @@ -1579,17 +1577,14 @@ function initProfile() { } catch(e) {} }); - // Logout button — delegates to global handleLogout for proper session cleanup + // Logout button — delegates to global handleLogout (no confirm) if (logoutBtn) { logoutBtn.addEventListener('click', function() { - if (confirm(t('confirm.logout') || 'Voulez-vous vraiment vous deconnecter ?')) { - if (typeof window.handleLogout === 'function') { - window.handleLogout(); - } else { - // Fallback if handleLogout not loaded - fetch('/api/auth/logout', { method: 'POST', credentials: 'include' }) - .finally(function() { window.location.href = '/'; }); - } + if (typeof window.handleLogout === 'function') { + window.handleLogout(); + } else { + fetch('/api/auth/logout', { method: 'POST', credentials: 'include' }) + .finally(function() { window.location.href = '/'; }); } }); }