Applied profile fix for login and logout #5
16
index.php
16
index.php
@@ -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();
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user