Not sure how I can edit this to reflect the fact that removing the hook is not a solution as quite rightly pointed out below. At the same time I don’t want to delete the whole post.
So… GO STRAIGHT TO THE SOLUTION - my ideas were not correct.
THIS IS A WORK IN PROGRESS - I’m just trying to work out what’s happening but this appears to be working for now…
After struggling to get ReCaptchaV2 working I came up with some workarounds. Firstly I can’t get the V2 tick box version working at all. It appears to work but you can send forms without actually ticking the box - so no good.
The only way I got the V2 invisible recaptcha to work is this…
&hooks=`FormItSaveForm,email,redirect
note I removed the recaptchav2 hook.
Nothing special about the next bit - just included…
This seems to work ie. spam is reduced greatly and it doesn’t seem possible to bypass the recaptcha. I don’t know why it works - simply trial and error so maybe somebody with more knowledge than me can explain or rewrite my effort above in a more coherent way.
Deleting recaptcha2 was only one step of the solution. Then it was reinstalled and the recaptcha2 hook is used on the form. Without the hook you aren’t using recaptcha.
Thanks Lucy but it’s really confusing as even without the hook the validation tick box opens up and seems to work. I add the hook back in and it doesn’t work at all. For the time being I’m going back to the formit recaptcha.
There are multiple parts involved when using Recaptcha.
One part is the javascript code in the frontend to analyse the behaviour of the user. (This part is included with recaptchav2_render.)
The second part is the hook recaptchav2 that is executed on the server ONLY when the form is sent (to check the g-recaptcha-response-value submitted with the form).
When you only remove the hook, then the javascript code (on the frontend) is still working (and you see the tick box), but you never verify the submitted value.
Have you ever tried to analyse the response value of the API-call to Google, like I suggested in your last thread regarding Recaptchav2:
For example if your secret key is wrong, you should see something like this in the error log
Thanks for your patience with this. I did test at the time but I’ve just tested again.
No pertinent output to the error log just…
A load of: Language string not found
And this where snippet 18 is recaptchav2: [2021-07-04 13:52:46] (DEBUG @ /##/##/##/##/##/core/cache/includes/elements/modsnippet/18.include.cache.php : 79)
Trie dall the different levels of logging and also changed the snippet code as you suggested.
In chrome console I get a couple of: [Violation] ‘requestIdleCallback’ handler took 85ms
I’m wondering if upgrading to 2.8.3 might fix this but can’t help thinking that it won’t.
I followed everything in Lucy’s post here and also stripped any styling / columns / divs out of the contact form as well as getting rid of… &emailUseFieldForSubject=`1
…and it is now working. The crazy thing about this is - it’s a generic form I use on loads of sites. I’ve been through and checked those sites and it’s working on them. There are differences in that this was a brand new install of Modx 2.8.1 and PHP 7.4 with Formit 4.2.6. All other sites are still on the slightly older version of Formit and so I have to remember to go back and check those when updating Formit. Some part of the form or html wasn’t playing nicely with RecaptchaV2 and formit 4.2.6.
This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting “+ New Topic”.