mirror of
https://github.com/supabase/supabase.git
synced 2026-09-06 09:59:03 +08:00
Allows a user to add a password which automatically creates and email identity to enable email + password authentication for OAuth-only accounts. Gated behind a feature flag: `enableAccountPassword` When a user does not have an email identity, allow them to set a password: <img width="762" height="284" alt="Screenshot 2026-08-13 at 14 52 53" src="https://github.com/user-attachments/assets/70b4883a-ed38-488a-a1b7-908caa112a0b" /> Password modal: <img width="519" height="423" alt="Screenshot 2026-08-13 at 14 56 57" src="https://github.com/user-attachments/assets/56ac370d-9e6c-4b05-986f-3aa9a51826c2" /> Email identity has been created, allow unlinking and/or updating email address or password: <img width="764" height="285" alt="Screenshot 2026-08-13 at 14 55 04" src="https://github.com/user-attachments/assets/5d9d7692-f4e3-4638-958d-15fefad01333" /> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * OAuth-only accounts can set a password from Sign-in methods. * Added password visibility controls, validation guidance, and success or error feedback. * Sign-in methods display the account email when available. * **Updates** * Renamed “Account identities” to “Sign-in methods” throughout account preferences. * Standardized password requirements across password setup and reset forms. * Setting a password refreshes the current session and signs out other sessions. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
16 lines
657 B
TypeScript
16 lines
657 B
TypeScript
import { z } from 'zod'
|
|
|
|
export const passwordValidation = z
|
|
.string()
|
|
.min(1, 'Password is required')
|
|
.max(72, 'Password cannot exceed 72 characters')
|
|
.refine((password) => {
|
|
const hasUppercase = /[A-Z]/.test(password)
|
|
const hasLowercase = /[a-z]/.test(password)
|
|
const hasNumber = /[0-9]/.test(password)
|
|
const hasSpecialChar = /[!@#$%^&*()_+\-=\[\]{};`':"\\|,.<>\/?]/.test(password)
|
|
const isLongEnough = password.length >= 8
|
|
|
|
return hasUppercase && hasLowercase && hasNumber && hasSpecialChar && isLongEnough
|
|
}, 'Password must contain at least 8 characters, including uppercase, lowercase, number, and special character')
|