diff --git a/web/src/features/auth/sign-in/components/user-auth-form.tsx b/web/src/features/auth/sign-in/components/user-auth-form.tsx index 39d41a6b..cbd61a7b 100644 --- a/web/src/features/auth/sign-in/components/user-auth-form.tsx +++ b/web/src/features/auth/sign-in/components/user-auth-form.tsx @@ -72,6 +72,7 @@ export function UserAuthForm({ const [isPasskeyLoading, setIsPasskeyLoading] = useState(false) const [isWeChatDialogOpen, setIsWeChatDialogOpen] = useState(false) const [isWeChatSubmitting, setIsWeChatSubmitting] = useState(false) + const [turnstileWidgetKey, setTurnstileWidgetKey] = useState(0) const legalConsentErrorMessage = t('Please agree to the legal terms first') const loginFailedMessage = t('Login failed') @@ -158,12 +159,18 @@ export function UserAuthForm({ if (!validateTurnstile()) return + const submittedTurnstileToken = turnstileToken + if (isTurnstileEnabled) { + setTurnstileToken('') + setTurnstileWidgetKey((current) => current + 1) + } + setIsLoading(true) try { const res = await login({ username: data.username, password: data.password, - turnstile: turnstileToken, + turnstile: submittedTurnstileToken, }) if (res.success) { @@ -408,8 +415,10 @@ export function UserAuthForm({ {isTurnstileEnabled && (
setTurnstileToken('')} />
)}