Skip to content
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

fix(recaptcha): validate on form submit, not button click #3662

Closed
wants to merge 1 commit into from

Conversation

dkoo
Copy link
Contributor

@dkoo dkoo commented Jan 9, 2025

All Submissions:

Changes proposed in this Pull Request:

Moves the event handler to render the reCAPTCHA v2 challenge to form submit instead of submit button click. This allows us to validate the form interaction no matter how the form is submitted—whether via submit button click, "enter" keypress, or even programmatically via JS.

How to test the changes in this Pull Request:

Test all protected flows protected by reCAPTCHA v2 by both clicking on the submit button and by hitting the "enter" key from the form inputs:

  • Auth modal: registration
  • Auth modal: login
  • Registration block
  • Newsletter Subscription Form block
  • Checkout as an anonymous reader
  • Checkout as a logged-in reader

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@dkoo dkoo added the [Status] Needs Review The issue or pull request needs to be reviewed label Jan 9, 2025
@dkoo dkoo self-assigned this Jan 9, 2025
@dkoo dkoo requested a review from a team as a code owner January 9, 2025 18:15
}
} );
}, true );
Copy link
Contributor Author

@dkoo dkoo Jan 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useCapture is necessary to prevent the gateways' iframes from bubbling their listeners to submit the checkout form separately.

@dkoo
Copy link
Contributor Author

dkoo commented Jan 14, 2025

Superseded by #3676.

@dkoo dkoo closed this Jan 14, 2025
@dkoo dkoo deleted the fix/recaptcha-on-keypress branch January 14, 2025 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Status] Needs Review The issue or pull request needs to be reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant