You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(auth): SSR auth guards on admin and profile pages
Adds `export const prerender = false` + `await auth.requireUser()` to
admin.astro, admin-members.astro, admin-settings.astro, profile.astro.
The platform turns AuthRequiredError into a 303 → /auth/sign-in?return_to=…
automatically — no try/catch (catching the error is the silent-null bug
the brief calls out).
For admin pages, requireUser is followed by an adminDb() lookup against
members.role. Using auth.requireRole('admin') wouldn't work — the Actor
envelope carries platform identity only; Kychon's "admin" is a project-
defined member role. Annotated the user_id filter with
`run402-allow-user-filter:` since adminDb() bypasses RLS by design.
Non-admin signed-in visitors now get a 403 from the page itself instead
of a fully-rendered admin shell with a client-side redirect — the admin
HTML and JS bundles never reach unauthorized browsers. /join stays
prerendered because it IS the sign-in surface.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments