diff --git a/frontend/src/components/Captcha.jsx b/frontend/src/components/Captcha.jsx index 6c2df87..47d13e5 100644 --- a/frontend/src/components/Captcha.jsx +++ b/frontend/src/components/Captcha.jsx @@ -1,5 +1,5 @@ import { useEffect, useRef } from 'react' -import { TURNSTILE_SITE_KEY } from '../config/captcha' +import { CAPTCHA_ENABLED, TURNSTILE_SITE_KEY } from '../config/captcha' const TURNSTILE_SCRIPT_ID = 'cf-turnstile-script' const TURNSTILE_SCRIPT_URL = @@ -10,7 +10,9 @@ export default function Captcha({ onToken }) { const widgetIdRef = useRef(null) useEffect(() => { - if (!TURNSTILE_SITE_KEY || !containerRef.current) return + if (!CAPTCHA_ENABLED || !TURNSTILE_SITE_KEY || !containerRef.current) { + return + } let cancelled = false @@ -108,7 +110,9 @@ export default function Captcha({ onToken }) { } }, [onToken]) - if (!TURNSTILE_SITE_KEY) return null + if (!CAPTCHA_ENABLED || !TURNSTILE_SITE_KEY) { + return null + } return (