Closed andrewhawkes closed 1 year ago
Hey @andrewhawkes, did you check the log file for any errors?
@billmn ahh sorry - I didn't look (weekend dev brain!)
Looks like there are some errors
2023-08-06 11:17:38 [web.ERROR] [billmn\turnstile\services\Validator::verify] {"success":false,"error-codes":["invalid-input-secret"],"messages":[]} {"memory":24941064}
Have you entered both site and secret keys?
Seems the secret was invalid: https://developers.cloudflare.com/turnstile/get-started/server-side-validation/#error-codes
@billmn turns out I'd passed the site key twice in the plugin options from my environment variables 🙄 It's working as expected now. Thanks for your help!
I've followed the docs and added a check for Craft's contact form plugin to block the sending of submissions if the Turnstile validator fails.
The captcha is loading as expected on the front end. I've tried locally and on a live domain and the following always gives a failed captcha challenge.
Turnstile::getInstance()->validator->verify();
returnsfalse
Turnstile::getInstance()->validator->passes();
returnsfalse
Turnstile::getInstance()->validator->fails();
returnstrue
I'm passing real data and the captcha appears to pass on the front end.