feat(auth): recover a password with a code sent by email
Enable BetterAuth's emailOTP plugin for password resets: a 6-digit code, valid for 10 minutes with 3 attempts, stored hashed in `verifications` (no migration). The code goes out through the existing Resend mailer with a new Spanish template, and other sessions are revoked after the reset. The web app gets a two-step /forgot-password route (request the code, then set the new password) linked from sign-in. Unknown emails get the same responses as known ones so the form doesn't reveal accounts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -85,7 +85,19 @@ function SignInPage() {
|
||||
</Field>
|
||||
|
||||
<Field data-invalid={!!form.formState.errors.password}>
|
||||
<FieldLabel htmlFor="password">Contraseña</FieldLabel>
|
||||
<div className="flex items-center justify-between">
|
||||
<FieldLabel htmlFor="password">Contraseña</FieldLabel>
|
||||
<Link
|
||||
to="/forgot-password"
|
||||
search={() => {
|
||||
const email = form.getValues('email')
|
||||
return { redirect, email: email || undefined }
|
||||
}}
|
||||
className="text-muted-foreground text-sm underline-offset-4 hover:text-foreground hover:underline"
|
||||
>
|
||||
¿Olvidaste tu contraseña?
|
||||
</Link>
|
||||
</div>
|
||||
<Input
|
||||
id="password"
|
||||
type="password"
|
||||
|
||||
Reference in New Issue
Block a user