diff --git a/frontend/index.html b/frontend/index.html index 6b4d7fe..2f39334 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -633,6 +633,56 @@ > + + diff --git a/frontend/js/config.js b/frontend/js/config.js index dca80df..0092e7a 100644 --- a/frontend/js/config.js +++ b/frontend/js/config.js @@ -617,6 +617,33 @@ function initConfigModal() { // Load existing keys on modal open document.getElementById("config-open-btn").addEventListener("click", loadAIKeys); + // Profile menu button: open config modal and scroll to profile section + var profileBtn = document.getElementById("profile-open-btn"); + if (profileBtn) { + profileBtn.addEventListener("click", function() { + openConfigModal(); + setTimeout(function() { + var el = document.getElementById("cfg-profile"); + if (el) el.scrollIntoView({ behavior: 'smooth' }); + }, 300); + }); + } + + // Logout button + var logoutBtn = document.getElementById("logout-btn"); + if (logoutBtn && AuthManager && AuthManager._authEnabled) { + // Show if user is logged in + var user = AuthManager.getCurrentUser(); + if (user) logoutBtn.style.display = ''; + logoutBtn.addEventListener("click", function() { + if (confirm("Voulez-vous vraiment vous deconnecter ?")) { + fetch("/api/auth/logout", { method: "POST" }) + .then(function() { window.location.reload(); }) + .catch(function() { window.location.reload(); }); + } + }); + } + // Config nav search var cfgSearch = document.getElementById("config-nav-search"); if (cfgSearch) {