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
+4
View File
@@ -327,6 +327,10 @@ export const updatePolicyStatusSchema = z.object({
// ─── Member self-profile and COI ─────────────────────────────────────────────
export const emailChangeSchema = z.object({
email: z.string().email('Enter a valid email address').max(254),
})
export const updateMyProfileSchema = z.object({
display_name: z.string().min(1).max(100).optional(),
handle: z.string().max(50).optional().nullable(),