diff --git a/packages/studiocms_dashboard/src/components/DashboardPageHeader.astro b/packages/studiocms_dashboard/src/components/DashboardPageHeader.astro
new file mode 100644
index 000000000..6778278a6
--- /dev/null
+++ b/packages/studiocms_dashboard/src/components/DashboardPageHeader.astro
@@ -0,0 +1,56 @@
+---
+import { getLangFromUrl, useTranslations } from 'studiocms:i18n';
+import DiscordLogo from '@studiocms/assets/svgs/discord.svg?raw';
+import { Button } from '@studiocms/ui/components';
+import Icon from '@studiocms/ui/utils/Icon.astro';
+import UserName from './islands/dashboard/UserName.astro';
+
+const lang = getLangFromUrl(Astro.url);
+const t = useTranslations(lang, '@studiocms/dashboard:index');
+---
+
+
+
\ No newline at end of file
diff --git a/packages/studiocms_dashboard/src/components/SingleSidebar.astro b/packages/studiocms_dashboard/src/components/SingleSidebar.astro
index a244f8120..d1a91caad 100644
--- a/packages/studiocms_dashboard/src/components/SingleSidebar.astro
+++ b/packages/studiocms_dashboard/src/components/SingleSidebar.astro
@@ -1,6 +1,6 @@
---
import { getLangFromUrl, useTranslatedPath, useTranslations } from 'studiocms:i18n';
-import { Divider, Dropdown, Sidebar } from '@studiocms/ui/components';
+import { Divider, Dropdown, Sidebar, User } from '@studiocms/ui/components';
import StudioCMSLogo from '../components/StudioCMSLogo.astro';
import SidebarLink from './SidebarLink.astro';
import Admin from './islands/sidebar/Admin.astro';
@@ -40,7 +40,9 @@ const tPath = useTranslatedPath(lang);
offset={8}
>
-
+
+
+
diff --git a/packages/studiocms_dashboard/src/components/islands/LoginChecker.astro b/packages/studiocms_dashboard/src/components/islands/LoginChecker.astro
new file mode 100644
index 000000000..5d54710a2
--- /dev/null
+++ b/packages/studiocms_dashboard/src/components/islands/LoginChecker.astro
@@ -0,0 +1,35 @@
+---
+import { getUserData, verifyUserPermissionLevel } from 'studiocms:auth/lib/user';
+import { StudioCMSRoutes } from 'studiocms:helpers/routemap';
+
+interface Props {
+ requiredPermission: 'owner' | 'admin' | 'editor' | 'visitor' | 'unknown';
+}
+
+const { requiredPermission } = Astro.props;
+
+const user = await getUserData(Astro);
+
+const isAuthorized = await verifyUserPermissionLevel(user, requiredPermission);
+---
+
+
+
+
+
diff --git a/packages/studiocms_dashboard/src/components/islands/dashboard/PageHeader.astro b/packages/studiocms_dashboard/src/components/islands/dashboard/PageHeader.astro
deleted file mode 100644
index a08ac7371..000000000
--- a/packages/studiocms_dashboard/src/components/islands/dashboard/PageHeader.astro
+++ /dev/null
@@ -1,43 +0,0 @@
----
-import { logger } from '@it-astro:logger:studiocms-dashboard';
-import { getUserData, verifyUserPermissionLevel } from 'studiocms:auth/lib/user';
-import { StudioCMSRoutes } from 'studiocms:helpers/routemap';
-import { getLangFromUrl, useTranslations } from 'studiocms:i18n';
-import DiscordLogo from '@studiocms/assets/svgs/discord.svg?raw';
-import { Button } from '@studiocms/ui/components';
-import Icon from '@studiocms/ui/utils/Icon.astro';
-import { default as PageHead } from '../../PageHeader.astro';
-
-const user = await getUserData(Astro);
-
-if (!user.user) {
- return Astro.redirect(StudioCMSRoutes.authLinks.loginURL);
-}
-
-const referer = Astro.request.headers.get('referer');
-
-if (!referer) {
- throw new Error('No referer found');
-}
-
-const lang = getLangFromUrl(new URL(referer));
-const t = useTranslations(lang, '@studiocms/dashboard:index');
-
-// Check Permission Level
-if (!verifyUserPermissionLevel(user, 'editor')) {
- logger.info('User is not an admin or editor. Redirecting to profile page.');
- return Astro.redirect(StudioCMSRoutes.mainLinks.userProfile);
-}
----
-
-
-
-
\ No newline at end of file
diff --git a/packages/studiocms_dashboard/src/components/islands/dashboard/UserName.astro b/packages/studiocms_dashboard/src/components/islands/dashboard/UserName.astro
new file mode 100644
index 000000000..6412ec2bc
--- /dev/null
+++ b/packages/studiocms_dashboard/src/components/islands/dashboard/UserName.astro
@@ -0,0 +1,6 @@
+---
+import { getUserData } from 'studiocms:auth/lib/user';
+
+const user = await getUserData(Astro);
+---
+
\ No newline at end of file
diff --git a/packages/studiocms_dashboard/src/components/islands/sidebar/Admin.astro b/packages/studiocms_dashboard/src/components/islands/sidebar/Admin.astro
index 07b74d7d2..26ab64ba3 100644
--- a/packages/studiocms_dashboard/src/components/islands/sidebar/Admin.astro
+++ b/packages/studiocms_dashboard/src/components/islands/sidebar/Admin.astro
@@ -1,7 +1,6 @@
---
import { getUserData } from 'studiocms:auth/lib/user';
import { verifyUserPermissionLevel } from 'studiocms:auth/lib/user';
-import { StudioCMSRoutes } from 'studiocms:helpers/routemap';
import { getLangFromUrl, useTranslatedPath, useTranslations } from 'studiocms:i18n';
import pluginList from 'studiocms:plugins';
import { Divider } from '@studiocms/ui/components';
@@ -14,10 +13,6 @@ const tPath = useTranslatedPath(lang);
const data = await getUserData(Astro);
-if (!data.user) {
- return Astro.redirect(StudioCMSRoutes.authLinks.loginURL);
-}
-
const isAdmin = await verifyUserPermissionLevel(data, 'admin');
const filteredPluginList = pluginList.filter((plugin) => !!plugin.settingsPage);
diff --git a/packages/studiocms_dashboard/src/components/islands/sidebar/UserAccount.astro b/packages/studiocms_dashboard/src/components/islands/sidebar/UserAccount.astro
index b832371b4..f659ddf23 100644
--- a/packages/studiocms_dashboard/src/components/islands/sidebar/UserAccount.astro
+++ b/packages/studiocms_dashboard/src/components/islands/sidebar/UserAccount.astro
@@ -1,13 +1,8 @@
---
import { getUserData } from 'studiocms:auth/lib/user';
import { getLabelForPermissionLevel } from 'studiocms:auth/utils/getLabelForPermissionLevel';
-import { StudioCMSRoutes } from 'studiocms:helpers/routemap';
import { User } from '@studiocms/ui/components';
const data = await getUserData(Astro);
-
-if (!data.user) {
- return Astro.redirect(StudioCMSRoutes.authLinks.loginURL);
-}
---
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/packages/studiocms_dashboard/src/routes/index.astro b/packages/studiocms_dashboard/src/routes/index.astro
index 1bdf8e919..c28c81129 100644
--- a/packages/studiocms_dashboard/src/routes/index.astro
+++ b/packages/studiocms_dashboard/src/routes/index.astro
@@ -4,7 +4,8 @@ import { getSiteConfig } from 'studiocms:helpers/contentHelper';
import { getLangFromUrl, staticPaths, useTranslatedPath, useTranslations } from 'studiocms:i18n';
import type { GetStaticPaths } from 'astro';
import { Layout } from '../components';
-import PageHeader from '../components/islands/dashboard/PageHeader.astro';
+import PageHeader from '../components/DashboardPageHeader.astro';
+import LoginChecker from '../components/islands/LoginChecker.astro';
import { makePageTitle } from '../utils/makePageTitle';
const contextConfig = await getSiteConfig();
@@ -22,11 +23,13 @@ export const getStaticPaths = (() => {
// const webVitals = await getWebVitals();
---
+
+
-
+
{t('sub-header')}