Compare commits

...
Author SHA1 Message Date
Claude 31a9b034a6 fix: allow @nomadkaraoke.com emails to access admin dashboard
Updates AdminLayout to grant admin access to users with @nomadkaraoke.com
email addresses, matching the admin validation logic in E2E tests.

Previously, only users with role="admin" could access /admin, causing
users with @nomadkaraoke.com emails to be redirected to /app.
2026-01-03 19:36:17 +00:00
+7 -4
View File
@@ -93,10 +93,13 @@ export default function AdminLayout({
return
}
// Check if user is admin
if (user && user.role !== "admin") {
router.replace("/app")
return
// Check if user is admin (either by role or @nomadkaraoke.com email)
if (user) {
const isAdmin = user.role === "admin" || user.email?.endsWith("@nomadkaraoke.com")
if (!isAdmin) {
router.replace("/app")
return
}
}
// If we have a token but no user yet, wait for auth to load