getgrav / grav-premium-issues

Official Grav Premium Issues repository to report problems or ask questions regarding the Premium products offered.
https://getgrav.org/premium
7 stars 2 forks source link

[typhoon] reCAPTCHA on Contact Form #322

Closed HelterSkelter5 closed 1 year ago

HelterSkelter5 commented 1 year ago

Hi,

How do you add reCAPTCHA to one of the template's contact forms? Adding the following code doesn't appear to work:

recaptcha: version: 2-invisible theme: dark site_key: 6Lc7... secret_key: 6Lc7...

and

process: captcha: true

No sign of any captcha presence at all and nothing logged in reCAPTCHA stats.

TIA

HS

HelterSkelter5 commented 1 year ago

Just to add to this, I know the settings are supposed to be invisible but there should be some evidence that reCAPTCHA is there? Anything dodgy entered into the form just produces a red notice but the form still sends so the reCAPTCHA doesn't appear to be having any effect on the form action.

rhukster commented 1 year ago

Problems with recaptcha would be outside of the theme itself, it's usually a form plugin configuration thing.

Does basic captcha work for you? Also in latest Form, we have implemented Turnstile captcha which in our testing is more transparent and more reliable than Google. Regarding Google reCaptcha, you should use Version 3.

HelterSkelter5 commented 1 year ago

Thanks.

v3 Captcha doesn't seem to work at all - correct site keys are in but there's always a problematic form entry. Nothing logged at Google's end.

Any links to deploying Turnstile captcha and the parameters needed to use in form? Nothing in Typhoon docs.

HelterSkelter5 commented 1 year ago

Documentation at https://learn.getgrav.org/16/forms/forms/fields-available is inconsistent and results in a Captcha failed error. Yes, it is set up at Cloudflare end.

w00fz commented 1 year ago

What kind of error ? Are you following https://learn.getgrav.org/16/forms/forms/fields-available#turnstile-captcha-field-cloudflare ?

HelterSkelter5 commented 1 year ago

It looks like it was a latency issue with Cloudflare. I'd updated forms.yaml with the parameters but nothing was displaying at the foot of the form.

It is a much more elegant solution than reCAPTCHA.

Is there any way to increase the size of the box to match the form field width? Aside from that niggle, Turnstile is a bit of a dream!

w00fz commented 1 year ago

I know!

I literally just added Turnstile support in forms a week ago, brand new, and even that implementation was a breeze to work with. Cleaner, simpler, more reliable!

Glad you got it all sorted, I think moving forward we are going to suggest Turnstile as our preferred captcha method and Basic captcha for no-service ties. Google is just too messy.

I didn't see any documentation regarding the size box, but I think you should be able to target the html element and do some manipulation via CSS to make it match a bit better. Personally I've been using the invisible mode, so nothing shows. The managed is equally good as it would only show when actually needed, if Cloudflare detects no suspicious, it will not bother adding the visual checkbox at all and just mark the user as legit.