fix: header logout button dynamically recreated by renderUserMenu

- renderUserMenu() rebuilds #logout-btn with innerHTML, wiping inline onclick
- Added onclick='window.handleLogout()' to the dynamic innerHTML string
- Restored addEventListener as double safety
- Settings #profile-logout already has onclick to handleLogout
This commit is contained in:
2026-07-24 10:04:13 -04:00
parent 8bbf973097
commit 88b73f663f
+2 -2
View File
@@ -203,11 +203,11 @@ const AuthManager = {
userMenu.innerHTML = "";
return;
}
userMenu.innerHTML = '<span class="user-display-name">' + (user.display_name || user.username) + "</span>" + '<button class="btn-logout" id="logout-btn" title="' + t('auth.logout_title') + '"><i data-lucide="log-out" style="width:14px;height:14px"></i></button>';
userMenu.innerHTML = '<span class="user-display-name">' + (user.display_name || user.username) + "</span>" + '<button class="btn-logout" id="logout-btn" title="' + t('auth.logout_title') + '" onclick="window.handleLogout()"><i data-lucide="log-out" style="width:14px;height:14px"></i></button>';
safeCreateIcons();
const logoutBtn = document.getElementById("logout-btn");
// Logout button — handled inline in index.html
if (logoutBtn) logoutBtn.addEventListener("click", () => AuthManager.logout());
const adminRow = document.getElementById("admin-menu-row");
if (adminRow) {