This commit is contained in:
2025-12-08 00:07:43 +01:00
parent 352ad4c512
commit b3f10164de
2 changed files with 10 additions and 12 deletions

View File

@@ -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 || {});