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

feat(my-account): reCAPTCHA check on add payment method #3673

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

dkoo
Copy link
Contributor

@dkoo dkoo commented Jan 13, 2025

All Submissions:

Changes proposed in this Pull Request:

Adds a reCAPTCHA check to the form to add payment methods in My Account.

How to test the changes in this Pull Request:

We'll want to test with both reCAPTCHA v2 and v3.

  1. Enable reCAPTCHA v2 in Newspack > Connections and check out this branch.
  2. At this line, add error_log( print_r( $captcha_verify, true ) ); so we can confirm that we're verifying with the reCAPTCHA service after form submit.
  3. Register a new reader account, log in, and verify as needed to view My Account.
  4. Visit <site URL>/my-account/add-payment-method/ and add a payment method.
  5. (when testing v2 only) Confirm that you get a v2 widget challenge when you click the "Add payment method" submit button.
  6. After submitting the form, confirm that the verification result is logged to debug.log (after adding the error_log in step 2).
  7. To test a rejection, add return new \WP_Error( 'newspack_test_error', 'Test error message' ); at this line.
  8. Repeat the "Add payment method" form submission and confirm that the submission is rejected with your test error message (note that the message might disappear after a second, but this seems to be a WooCommerce behavior and not related to this PR). Visit <site URL>/my-account/payment-methods and confirm that a new payment method was NOT saved.
  9. Repeat all testing steps with reCAPTCHA v3.

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 13, 2025
@dkoo dkoo self-assigned this Jan 13, 2025
@dkoo dkoo requested a review from a team as a code owner January 13, 2025 18:03
@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Jan 13, 2025
@leogermani leogermani merged commit 4a46c8e into release Jan 13, 2025
12 checks passed
matticbot pushed a commit that referenced this pull request Jan 13, 2025
# [5.11.0](v5.10.6...v5.11.0) (2025-01-13)

### Features

* **my-account:** reCAPTCHA check on add payment method ([#3673](#3673)) ([4a46c8e](4a46c8e))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 5.11.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@dkoo dkoo deleted the hotfix/protect-add-payment-method branch January 14, 2025 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released [Status] Approved The pull request has been reviewed and is ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants