Skip to content

Commit 1cc3953

Browse files
committed
Fix Turnstile timeout issues with validation and submission state
1 parent b130394 commit 1cc3953

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/web/assets/frontend/dist/js/captchas/turnstile.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/frontend/src/js/captchas/turnstile.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,10 @@ export class FormieTurnstile extends FormieCaptchaProvider {
176176
onExpired() {
177177
console.log('Turnstile has expired - reloading.');
178178

179+
// Clear submitHandler so that when Turnstile calls the callback after reset (auto-refresh),
180+
// we don't accidentally re-submit the form. See: https://github.com/verbb/formie/issues/2734
181+
this.submitHandler = null;
182+
179183
if (!this.$activePlaceholder) {
180184
return;
181185
}
@@ -190,6 +194,10 @@ export class FormieTurnstile extends FormieCaptchaProvider {
190194
onTimeout() {
191195
console.log('Turnstile has expired challenge - reloading.');
192196

197+
// Clear submitHandler so that when Turnstile calls the callback after reset,
198+
// we don't accidentally re-submit the form. See: https://github.com/verbb/formie/issues/2734
199+
this.submitHandler = null;
200+
193201
if (!this.$activePlaceholder) {
194202
return;
195203
}

0 commit comments

Comments
 (0)