Closed darQrrR closed 3 years ago
Did you observe that happening using V3? I’ve read the invisible Re captcha is supposed to detect user interactions and “just work”? Also the documentation on refreshing seems to all be with respect to V2 which implies V3 doesn’t need it, but I guess the .execute() function can be called again on a timer—was that what you did?
(I think I would add the approach to the docs or a blog post rather than try to change the implementation for every install. What do you think?)
Happens with V3, not sure if the same problem occurs with V2 as well. And yes, we implemented a refresh of the token via timer but creating the token on submit would be the proper solution I guess.
I'd implement it within the package so it is solved for good but having it mentioned somewhere, would at least help those people facing this problem in the future. Entirely up to you :)
I have the same problem with V3 on a client site.
Google itself recommend to get the token when submitting the form (https://developers.google.com/recaptcha/docs/v3).
At the moment I solve this issue with a refresh timer (like darQrrR).
Ok this seems like a good candidate for a guide or some documentation with code examples. Hopefully will have a chance over the holidays to write that up
Hopefully this will help: https://sepiariver.com/modx/a-guide-to-recaptcha-v3-for-modx-cms/
I managed to solve it like this: `
` Instead of using a submit button, I add a 'regular' button (without type="submit") and check when it's clicked. Before submitting the form I execute the grecaptcha and then submit the form. Any remarks or ideas?Yep this works. Since the user is invoking it when they click to submit the form, there should be very little chance that they will time out. The call to recaptcha is blocking but that seems to be fast, generally.
By generating the token on pageload, the form has to be filled out within 2 minutes: https://developers.google.com/recaptcha/docs/verify
We set an autorefresh of the token within the tpl, maybe something you want to implement.