Skip to content

AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.

feat(frontend): hide captcha if verified (#10397)

Ubbe87f9af606e99
diff --git a/autogpt_platform/frontend/src/app/(platform)/login/page.tsx b/autogpt_platform/frontend/src/app/(platform)/login/page.tsx
index 4e297b4e03..cfd2c6513c 100644
--- a/autogpt_platform/frontend/src/app/(platform)/login/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/login/page.tsx
@@ -85,16 +85,18 @@ export default function LoginPage() {
/>
{/* Turnstile CAPTCHA Component */}
- <Turnstile
- key={captchaKey}
- siteKey={turnstile.siteKey}
- onVerify={turnstile.handleVerify}
- onExpire={turnstile.handleExpire}
- onError={turnstile.handleError}
- setWidgetId={turnstile.setWidgetId}
- action="login"
- shouldRender={turnstile.shouldRender}
- />
+ {!turnstile.shouldRender && !turnstile.verified ? (
+ <Turnstile
+ key={captchaKey}
+ siteKey={turnstile.siteKey}
+ onVerify={turnstile.handleVerify}
+ onExpire={turnstile.handleExpire}
+ onError={turnstile.handleError}
+ setWidgetId={turnstile.setWidgetId}
+ action="login"
+ shouldRender={turnstile.shouldRender}
+ />
+ ) : null}
<Button
variant="primary"
diff --git a/autogpt_platform/frontend/src/app/(platform)/reset-password/page.tsx b/autogpt_platform/frontend/src/app/(platform)/reset-password/page.tsx
index 593d56408e..eb34cea239 100644
--- a/autogpt_platform/frontend/src/app/(platform)/reset-password/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/reset-password/page.tsx
@@ -271,16 +271,19 @@ function ResetPasswordContent() {
/>
{/* Turnstile CAPTCHA Component for reset email */}
- <Turnstile
- key={sendEmailCaptchaKey}
- siteKey={sendEmailTurnstile.siteKey}
- onVerify={sendEmailTurnstile.handleVerify}
- onExpire={sendEmailTurnstile.handleExpire}
- onError={sendEmailTurnstile.handleError}
- setWidgetId={sendEmailTurnstile.setWidgetId}
- action="reset_password"
- shouldRender={sendEmailTurnstile.shouldRender}
- />
+ {!sendEmailTurnstile.shouldRender &&
+ !sendEmailTurnstile.verified ? (
+ <Turnstile
+ key={sendEmailCaptchaKey}
+ siteKey={sendEmailTurnstile.siteKey}
+ onVerify={sendEmailTurnstile.handleVerify}
+ onExpire={sendEmailTurnstile.handleExpire}
+ onError={sendEmailTurnstile.handleError}
+ setWidgetId={sendEmailTurnstile.setWidgetId}
+ action="reset_password"
+ shouldRender={sendEmailTurnstile.shouldRender}
+ />
+ ) : null}
<Button
variant="primary"
diff --git a/autogpt_platform/frontend/src/app/(platform)/signup/page.tsx b/autogpt_platform/frontend/src/app/(platform)/signup/page.tsx
index 738706cb79..6db0f718f7 100644
--- a/autogpt_platform/frontend/src/app/(platform)/signup/page.tsx
+++ b/autogpt_platform/frontend/src/app/(platform)/signup/page.tsx
@@ -163,16 +163,18 @@ export default function SignupPage() {
/>
{/* Turnstile CAPTCHA Component */}
- <Turnstile
- key={captchaKey}
- siteKey={turnstile.siteKey}
- onVerify={turnstile.handleVerify}
- onExpire={turnstile.handleExpire}
- onError={turnstile.handleError}
- setWidgetId={turnstile.setWidgetId}
- action="signup"
- shouldRender={turnstile.shouldRender}
- />
+ {!turnstile.shouldRender && !turnstile.verified ? (
+ <Turnstile
+ key={captchaKey}
+ siteKey={turnstile.siteKey}
+ onVerify={turnstile.handleVerify}
+ onExpire={turnstile.handleExpire}
+ onError={turnstile.handleError}
+ setWidgetId={turnstile.setWidgetId}
+ action="signup"
+ shouldRender={turnstile.shouldRender}
+ />
+ ) : null}
<Button
variant="primary"