Applied profile fix for login and logout

This commit is contained in:
Garcia-Gomez
2026-02-12 23:45:24 -08:00
parent 457170a1ae
commit efc1fc3906

View File

@@ -942,10 +942,20 @@
.then(data => { .then(data => {
bootstrap.Modal.getInstance(document.getElementById('loginModal')).hide(); bootstrap.Modal.getInstance(document.getElementById('loginModal')).hide();
// Show/hide settings button according to permissions
if (!data.user.can_manage_settings) { if (!data.user.can_manage_settings) {
document.querySelectorAll('.settings-btn').forEach(b => b.style.display = 'none'); document.querySelectorAll('.settings-btn').forEach(b => b.style.display = 'none');
} else {
document.querySelectorAll('.settings-btn').forEach(b => b.style.display = '');
} }
// Update user email in the dropdown and refresh profiles + projects
if (data.user && data.user.email) {
const userEl = document.getElementById('dropdownUserEmail');
if (userEl) userEl.textContent = data.user.email;
}
loadProfiles();
fetchProjects(); fetchProjects();
}) })
.catch(ex => { .catch(ex => {
@@ -1041,6 +1051,12 @@
// Clear UI // Clear UI
document.getElementById('projectGrid').innerHTML = ''; document.getElementById('projectGrid').innerHTML = '';
// Clear Profile List
document.getElementById('profileSelect').innerHTML = '';
// Clear User Email
document.getElementById('dropdownUserEmail').textContent = '';
// Show login modal // Show login modal
new bootstrap.Modal(document.getElementById('loginModal')).show(); new bootstrap.Modal(document.getElementById('loginModal')).show();
}) })