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