feat(me): self-service email change, verified (P3e)

requestEmailChange -> supabase.auth.updateUser({email},{emailRedirectTo
/auth/confirm}); with Secure email change on (recommended) Supabase
double-confirms old+new. New /auth/confirm route verifyOtp(email_change)
then syncs the denormalized space_members.email to the authoritative
auth email ONLY post-verification (idempotent). proxy.ts whitelists
/auth/confirm (exact). Profile-tab UI shows current email + change
control. REQUIRES Supabase config (template -> /auth/confirm?token_hash=
{{ .TokenHash }}&type=email_change + redirect allowlist) — documented in
P3f. 521 tests; build clean (flow not exercisable without that config).
This commit is contained in:
Moheeb Zara
2026-05-18 15:53:39 -07:00
parent 2c847befeb
commit 5edd778cf6
6 changed files with 139 additions and 3 deletions
+3 -1
View File
@@ -14,9 +14,11 @@ const PUBLIC_ROUTES = [
'/join',
// Public anonymous-incident status lookup by reporter token.
'/track',
// Only the OAuth callback is anonymous; scope to the exact route so a
// Only the OAuth callback + email-change confirm are anonymous (the link
// is clicked from an email, no session); scope to exact routes so a
// future /auth/* page is not silently public.
'/auth/callback',
'/auth/confirm',
'/api/health',
// Stripe calls this unauthenticated; it is verified by the per-space
// webhook signature, not a session. Must NOT be redirected to /login