Skip to content

Commit 4256aae

Browse files
waleedlatif1claude
andcommitted
fix(auth): reject captcha promise on token expiry
onExpire now rejects the pending promise so the form doesn't hang if the Turnstile token expires mid-challenge. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 33b7b31 commit 4256aae

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

apps/sim/app/(auth)/login/login-form.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -512,7 +512,12 @@ export default function LoginPage({
512512
captchaResolveRef.current = null
513513
captchaRejectRef.current = null
514514
}}
515-
onExpire={() => setCaptchaToken(null)}
515+
onExpire={() => {
516+
setCaptchaToken(null)
517+
captchaRejectRef.current?.(new Error('Captcha expired'))
518+
captchaResolveRef.current = null
519+
captchaRejectRef.current = null
520+
}}
516521
options={{ size: 'invisible', execution: 'execute' }}
517522
/>
518523
)}

apps/sim/app/(auth)/signup/signup-form.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -505,7 +505,12 @@ function SignupFormContent({
505505
captchaResolveRef.current = null
506506
captchaRejectRef.current = null
507507
}}
508-
onExpire={() => setCaptchaToken(null)}
508+
onExpire={() => {
509+
setCaptchaToken(null)
510+
captchaRejectRef.current?.(new Error('Captcha expired'))
511+
captchaResolveRef.current = null
512+
captchaRejectRef.current = null
513+
}}
509514
options={{ size: 'invisible', execution: 'execute' }}
510515
/>
511516
)}

0 commit comments

Comments
 (0)