-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate reCAPTCHA validation breaks checkout success redirect after initial server error response #320
Comments
Hi @nthurston. Thank you for your report. Add a comment to assign the issue:
|
Same issue for reCAPTCHA v2 ("i am not a robot").
Any other solution? |
Any update here? |
@web-planex FYI there is another ticket in the main repo where I think it is resolved. Not sure if it was checked for v2 though. |
My team is investigating. |
As it was stated in magento/magento2#35093 (comment), it looks like it was fixed in 25edf56. |
Preconditions (*)
Steps to reproduce (*)
Expected result (*)
Actual result (*)
Diagnosis
This presented with a custom Payment Gateway module, it was triggered by bad AVS validation but I suspect that any server side error will cause this sequence of events.
Main problem is in Magento_ReCaptchaWebapiUi/js/webapiReCaptchaRegistry.js addListener method. If the token has already been gathered, it simply calls the callback function.
In Magento_ReCaptchaCheckout/js/model/place-order-mixin.js this means the payment-information URL gets called with the old token.
As far as I am aware, a second validation request with the same token will always fail, so that request fails and rejects, completing the promise.
Meanwhile, place-order-mixin also triggers another validation which generates a new token.
When that returns it goes back into the callback, that request succeeds and the order is placed. However, the placeOrder deferred object has already been rejected with the original error.
It's not clear to me why you would ever want to reuse the old token, so I am able to solve this by simply changing the addListener method to this:
But I haven't studied the other reCAPTCHA modules enough to know if that will cause issues elsewhere. Perhaps v2 or checkbox should be handled differently.
Could potentially be solved with different logic in the place-order-mixin as well.
The text was updated successfully, but these errors were encountered: