Skip to content

The open alternative to Salesforce, designed for AI.

Fix turnstile captcha invalid (#5442)

Charles Bochetf31b2c296355
diff --git a/packages/twenty-front/src/modules/captcha/hooks/useRequestFreshCaptchaToken.ts b/packages/twenty-front/src/modules/captcha/hooks/useRequestFreshCaptchaToken.ts
index f97295225a8..f2e2821fc27 100644
--- a/packages/twenty-front/src/modules/captcha/hooks/useRequestFreshCaptchaToken.ts
+++ b/packages/twenty-front/src/modules/captcha/hooks/useRequestFreshCaptchaToken.ts
@@ -4,7 +4,6 @@ import { captchaTokenState } from '@/captcha/states/captchaTokenState';
import { isRequestingCaptchaTokenState } from '@/captcha/states/isRequestingCaptchaTokenState';
import { captchaProviderState } from '@/client-config/states/captchaProviderState';
import { CaptchaDriverType } from '~/generated-metadata/graphql';
-import { isDefined } from '~/utils/isDefined';
import { isUndefinedOrNull } from '~/utils/isUndefinedOrNull';
declare global {
@@ -31,10 +30,6 @@ export const useRequestFreshCaptchaToken = () => {
return;
}
- const existingCaptchaToken = snapshot
- .getLoadable(captchaTokenState)
- .getValue();
-
setIsRequestingCaptchaToken(true);
let captchaWidget: any;
@@ -51,12 +46,6 @@ export const useRequestFreshCaptchaToken = () => {
});
break;
case CaptchaDriverType.Turnstile:
- if (isDefined(existingCaptchaToken)) {
- // If we already have a token, we don't need to request a new one as turnstile will
- // automatically refresh the token when the widget is rendered.
- setIsRequestingCaptchaToken(false);
- break;
- }
// TODO: fix workspace-no-hardcoded-colors rule
// eslint-disable-next-line @nx/workspace-no-hardcoded-colors
captchaWidget = window.turnstile.render('#captcha-widget', {