fix(auth): accept 6-10 digit one-time codes on reset page (#1102)
The Email OTP Length on this project is 8, but the code input capped at maxLength 6, silently truncating what the user typed so every verify failed. gotrue allows 6-10 digits; the input now accepts that range and the placeholder no longer claims a specific length. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -21,7 +21,11 @@ import { Loader2, KeyRound } from 'lucide-react'
|
||||
* links but do not click buttons, so the one-time token survives
|
||||
* scanning. Never verify in an effect; that re-opens the burn.
|
||||
* - 'enter-code': no session, no token_hash. The email also carries a
|
||||
* 6-digit code the user can type together with their email address.
|
||||
* one-time code the user can type together with their email address.
|
||||
* The code length follows the project's Email OTP Length setting
|
||||
* (this project uses 8, gotrue allows 6-10), so the input must never
|
||||
* cap at 6: a maxLength shorter than the real code silently truncates
|
||||
* what the user types and every verify fails.
|
||||
*/
|
||||
type Mode = 'loading' | 'set-password' | 'confirm-link' | 'enter-code'
|
||||
|
||||
@@ -242,7 +246,7 @@ function ResetPasswordInner() {
|
||||
onChange={(e) => setCode(e.target.value)}
|
||||
required
|
||||
minLength={6}
|
||||
maxLength={6}
|
||||
maxLength={10}
|
||||
disabled={isLoading}
|
||||
className="h-11 tracking-widest"
|
||||
/>
|
||||
|
||||
+1
-1
@@ -858,7 +858,7 @@
|
||||
"code_subtitle": "Enter your email and the one-time code from the email.",
|
||||
"email_label": "Email address",
|
||||
"code_label": "One-time code",
|
||||
"code_placeholder": "6-digit code",
|
||||
"code_placeholder": "The code from the email",
|
||||
"code_button": "Verify code",
|
||||
"code_verifying": "Verifying...",
|
||||
"code_hint": "The code is in the password reset email. If no email arrived, request a new reset from the login page.",
|
||||
|
||||
+1
-1
@@ -858,7 +858,7 @@
|
||||
"code_subtitle": "Ange din e-post och engångskoden från mailet.",
|
||||
"email_label": "E-postadress",
|
||||
"code_label": "Engångskod",
|
||||
"code_placeholder": "6-siffrig kod",
|
||||
"code_placeholder": "Koden från mailet",
|
||||
"code_button": "Verifiera kod",
|
||||
"code_verifying": "Verifierar...",
|
||||
"code_hint": "Koden finns i mailet om lösenordsåterställning. Hittar du inget mail kan du begära en ny återställning från inloggningssidan.",
|
||||
|
||||
Reference in New Issue
Block a user