diff --git a/src/App.tsx b/src/App.tsx index ea51314..37e06ef 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -386,9 +386,10 @@ export function App() { return ; } - // Redirect authenticated users to /admin (but preserve impersonation flow via ?sessionId=) + // Redirect authenticated staff (non-customer) users to /admin (but preserve impersonation flow via ?sessionId=) const searchParams = new URLSearchParams(location.search); - if (!authDisabled && session && !location.pathname.startsWith("/admin") && !searchParams.has("sessionId")) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any -- Better Auth session.user extends Record; role field is injected by Authentik OIDC + if (!authDisabled && session && (session as any)?.user?.role !== "customer" && !location.pathname.startsWith("/admin") && !searchParams.has("sessionId")) { return ; }