mirror of
https://github.com/supabase/supabase.git
synced 2026-09-06 18:11:51 +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 -->
22 lines
673 B
TypeScript
22 lines
673 B
TypeScript
export const parseRedirectMessage = (asPath: string) =>
|
|
new URLSearchParams(asPath.split('#')[1] ?? '').get('message') ?? undefined
|
|
|
|
/**
|
|
* Whether to offer creating a password (which creates an email identity) to a user
|
|
* who signs in only through OAuth.
|
|
*/
|
|
export const shouldShowAddPasswordRow = ({
|
|
identities,
|
|
email,
|
|
}: {
|
|
identities: { provider: string }[]
|
|
email: string | undefined
|
|
}): boolean => {
|
|
if (!email) return false
|
|
|
|
const hasEmailIdentity = identities.some((identity) => identity.provider === 'email')
|
|
const hasSsoIdentity = identities.some((identity) => identity.provider.startsWith('sso'))
|
|
|
|
return !hasEmailIdentity && !hasSsoIdentity
|
|
}
|