mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-04-08 03:00:28 -04:00
chore: CAPTCHA
This commit is contained in:
@@ -21,6 +21,7 @@ export default function LoginPage() {
|
||||
isLoading,
|
||||
isLoggedIn,
|
||||
isCloudEnv,
|
||||
shouldNotRenderCaptcha,
|
||||
isUserLoading,
|
||||
isGoogleLoading,
|
||||
showNotAllowedModal,
|
||||
@@ -85,16 +86,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}
|
||||
/>
|
||||
{shouldNotRenderCaptcha ? null : (
|
||||
<Turnstile
|
||||
key={captchaKey}
|
||||
siteKey={turnstile.siteKey}
|
||||
onVerify={turnstile.handleVerify}
|
||||
onExpire={turnstile.handleExpire}
|
||||
onError={turnstile.handleError}
|
||||
setWidgetId={turnstile.setWidgetId}
|
||||
action="login"
|
||||
shouldRender={turnstile.shouldRender}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Button
|
||||
variant="primary"
|
||||
|
||||
@@ -28,6 +28,8 @@ export function useLoginPage() {
|
||||
resetOnError: true,
|
||||
});
|
||||
|
||||
const shouldNotRenderCaptcha = isVercelPreview || turnstile.verified;
|
||||
|
||||
const form = useForm<z.infer<typeof loginFormSchema>>({
|
||||
resolver: zodResolver(loginFormSchema),
|
||||
defaultValues: {
|
||||
@@ -125,6 +127,7 @@ export function useLoginPage() {
|
||||
isLoading,
|
||||
isCloudEnv,
|
||||
isUserLoading,
|
||||
shouldNotRenderCaptcha,
|
||||
isGoogleLoading,
|
||||
showNotAllowedModal,
|
||||
isSupabaseAvailable: !!supabase,
|
||||
|
||||
@@ -32,6 +32,7 @@ export default function SignupPage() {
|
||||
isLoading,
|
||||
isCloudEnv,
|
||||
isUserLoading,
|
||||
shouldNotRenderCaptcha,
|
||||
isGoogleLoading,
|
||||
showNotAllowedModal,
|
||||
isSupabaseAvailable,
|
||||
@@ -163,16 +164,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}
|
||||
/>
|
||||
{shouldNotRenderCaptcha ? null : (
|
||||
<Turnstile
|
||||
key={captchaKey}
|
||||
siteKey={turnstile.siteKey}
|
||||
onVerify={turnstile.handleVerify}
|
||||
onExpire={turnstile.handleExpire}
|
||||
onError={turnstile.handleError}
|
||||
setWidgetId={turnstile.setWidgetId}
|
||||
action="signup"
|
||||
shouldRender={turnstile.shouldRender}
|
||||
/>
|
||||
)}
|
||||
|
||||
<Button
|
||||
variant="primary"
|
||||
|
||||
@@ -30,6 +30,8 @@ export function useSignupPage() {
|
||||
resetOnError: true,
|
||||
});
|
||||
|
||||
const shouldNotRenderCaptcha = isVercelPreview || turnstile.verified;
|
||||
|
||||
const resetCaptcha = useCallback(() => {
|
||||
setCaptchaKey((k) => k + 1);
|
||||
turnstile.reset();
|
||||
@@ -132,6 +134,7 @@ export function useSignupPage() {
|
||||
isCloudEnv,
|
||||
isUserLoading,
|
||||
isGoogleLoading,
|
||||
shouldNotRenderCaptcha,
|
||||
showNotAllowedModal,
|
||||
isSupabaseAvailable: !!supabase,
|
||||
handleSubmit: form.handleSubmit(handleSignup),
|
||||
|
||||
Reference in New Issue
Block a user