Fixing reCAPTCHA and payment request button at checkout #3094
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All Submissions:
Changes proposed in this Pull Request:
There are two main fixes here:
In
pmpro-recaptcha-v3.js
, we were validating reCAPTCHA when the submit button was clicked. This did not run in cases where the checkout form was submitted via JS. To fix this behavior, this PR updates the validation to occur when the form is submitted. This is closer to how we validate the reCAPTCHA v2 as well.In
pmpro-stripe.js
, we had code to "force submit" the checkout form withform.get(0).submit();
after the payment request button was used or 3DS verification was completed. Although this worked for most use-cases, it prevents code running on the jQuery.submit()
method to run. This prevented our new reCAPTCHA v3 code (and I assume the old v2 code) from running. The fix here was to just callform.submit();
, which still allows.submit()
methods to run.Resolves XXX.
How to test the changes in this Pull Request:
Other information: