From c4b797f0b46e010b74e93a72fa8dfda5e9334cd2 Mon Sep 17 00:00:00 2001 From: Bruno Charest Date: Tue, 16 Jun 2026 12:17:45 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20Profil=20+=20Deconnexion=20dans=20le=20?= =?UTF-8?q?menu=20header=20(=E2=9A=99=EF=B8=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Profil: ouvre Config → scroll vers section Profil (langue, nom) - Deconnexion: logout via /api/auth/logout, visible si auth activee - Redemarrage: window.location.reload apres logout --- frontend/index.html | 50 +++++++++++++++++++++++++++++++++++++++++++ frontend/js/config.js | 27 +++++++++++++++++++++++ 2 files changed, 77 insertions(+) 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) {