YXx
This commit is contained in:
@@ -12,6 +12,8 @@ const state = {
|
||||
loading: false,
|
||||
};
|
||||
|
||||
const pageType = document.body?.dataset?.page || 'account';
|
||||
|
||||
let avatarBtn;
|
||||
let userMenuPanel;
|
||||
let profileForm;
|
||||
@@ -103,6 +105,13 @@ function isAdmin() {
|
||||
return role === 'owner' || role === 'admin';
|
||||
}
|
||||
|
||||
function enforcePageAccess() {
|
||||
if (pageType !== 'admin') return;
|
||||
if (isAdmin()) return;
|
||||
toast('Kein Zugriff auf diesen Bereich', false, { duration: 2500 });
|
||||
window.location.href = '/account.php';
|
||||
}
|
||||
|
||||
function updateAvatar() {
|
||||
const target = document.getElementById('userAvatar');
|
||||
if (!target) return;
|
||||
@@ -184,6 +193,7 @@ async function loadAccountData() {
|
||||
window.__currentUser = res.user;
|
||||
updateAvatar();
|
||||
updateRoleVisibility();
|
||||
enforcePageAccess();
|
||||
}
|
||||
fillProfileForm(res.user);
|
||||
fillSettingsForm(res.settings || {});
|
||||
|
||||
Reference in New Issue
Block a user