feat: Profil + Deconnexion dans le menu header (⚙️)
- 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
This commit is contained in:
@@ -633,6 +633,56 @@
|
|||||||
>
|
>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
<button
|
||||||
|
class="menu-list-row menu-list-button"
|
||||||
|
id="profile-open-btn"
|
||||||
|
type="button"
|
||||||
|
role="menuitem"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="menu-list-icon"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
data-lucide="user"
|
||||||
|
style="width: 17px; height: 17px"
|
||||||
|
></i>
|
||||||
|
</span>
|
||||||
|
<span class="menu-list-content">
|
||||||
|
<span class="menu-list-title"
|
||||||
|
>Profil</span
|
||||||
|
>
|
||||||
|
<span class="menu-list-subtitle"
|
||||||
|
>Langue & preferences</span
|
||||||
|
>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
class="menu-list-row menu-list-button"
|
||||||
|
id="logout-btn"
|
||||||
|
type="button"
|
||||||
|
role="menuitem"
|
||||||
|
style="display:none"
|
||||||
|
>
|
||||||
|
<span
|
||||||
|
class="menu-list-icon"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
data-lucide="log-out"
|
||||||
|
style="width: 17px; height: 17px; color: var(--danger)"
|
||||||
|
></i>
|
||||||
|
</span>
|
||||||
|
<span class="menu-list-content">
|
||||||
|
<span class="menu-list-title"
|
||||||
|
style="color:var(--danger)"
|
||||||
|
>Deconnexion</span
|
||||||
|
>
|
||||||
|
<span class="menu-list-subtitle"
|
||||||
|
>Quitter la session</span
|
||||||
|
>
|
||||||
|
</span>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -617,6 +617,33 @@ function initConfigModal() {
|
|||||||
// Load existing keys on modal open
|
// Load existing keys on modal open
|
||||||
document.getElementById("config-open-btn").addEventListener("click", loadAIKeys);
|
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
|
// Config nav search
|
||||||
var cfgSearch = document.getElementById("config-nav-search");
|
var cfgSearch = document.getElementById("config-nav-search");
|
||||||
if (cfgSearch) {
|
if (cfgSearch) {
|
||||||
|
|||||||
Reference in New Issue
Block a user