Merged in fix/SW-1695-clear-otp-password-on-error (pull request #1375)

Clear and focus OTP input on error

Approved-by: Joakim Jäderberg
This commit is contained in:
Anton Gunnarsson
2025-02-20 07:29:36 +00:00
parent 7b15687f07
commit e75c714148

View File

@@ -100,6 +100,7 @@ export default function OneTimePasswordForm({
function handleOTPEntered(otp: string) {
startTransition(async () => {
const redirectRes = await onSubmit({ otp })
setOtp("")
if (redirectRes.type === "replace") {
router.replace(redirectRes.url)
return
@@ -146,6 +147,7 @@ export default function OneTimePasswordForm({
</div>
<OTPInput
autoFocus
value={otp}
onChange={setOtp}
maxLength={otpLength}