fix: remove confirm() dialogs from both logout buttons
- 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
This commit is contained in:
+12
-17
@@ -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");
|
var logoutBtn = document.getElementById("logout-btn");
|
||||||
if (logoutBtn) {
|
if (logoutBtn) {
|
||||||
logoutBtn.addEventListener("click", function() {
|
logoutBtn.addEventListener("click", function() {
|
||||||
if (confirm(t('confirm.logout') || "Voulez-vous vraiment vous deconnecter ?")) {
|
if (typeof window.handleLogout === 'function') {
|
||||||
if (typeof window.handleLogout === 'function') {
|
window.handleLogout();
|
||||||
window.handleLogout();
|
} else {
|
||||||
} else {
|
fetch('/api/auth/logout', { method: 'POST', credentials: 'include' })
|
||||||
fetch('/api/auth/logout', { method: 'POST', credentials: 'include' })
|
.finally(function() { window.location.href = '/'; });
|
||||||
.finally(function() { window.location.href = '/'; });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1579,17 +1577,14 @@ function initProfile() {
|
|||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
});
|
});
|
||||||
|
|
||||||
// Logout button — delegates to global handleLogout for proper session cleanup
|
// Logout button — delegates to global handleLogout (no confirm)
|
||||||
if (logoutBtn) {
|
if (logoutBtn) {
|
||||||
logoutBtn.addEventListener('click', function() {
|
logoutBtn.addEventListener('click', function() {
|
||||||
if (confirm(t('confirm.logout') || 'Voulez-vous vraiment vous deconnecter ?')) {
|
if (typeof window.handleLogout === 'function') {
|
||||||
if (typeof window.handleLogout === 'function') {
|
window.handleLogout();
|
||||||
window.handleLogout();
|
} else {
|
||||||
} else {
|
fetch('/api/auth/logout', { method: 'POST', credentials: 'include' })
|
||||||
// Fallback if handleLogout not loaded
|
.finally(function() { window.location.href = '/'; });
|
||||||
fetch('/api/auth/logout', { method: 'POST', credentials: 'include' })
|
|
||||||
.finally(function() { window.location.href = '/'; });
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user