impress-org / givewp-snippet-library

A collection of code snippets to enhance or expand on the free Give WordPress Donation Plugin.
https://givewp.com
140 stars 90 forks source link

fix: ensure recaptcha does not disappear when switching gateways #84

Closed mehul0810 closed 4 years ago

mehul0810 commented 6 years ago

@samsmith89 commented on Mon Jul 30 2018

User Story

As a site admin, I want to my donors to be able to change to a different payment option without the recaptcha box disappeating so that I can cut down on Donor SPAM.

This only takes place on pages that are loading multiple forms, and on Firefox and IE browsers.

Current Behavior

I currently have other forms loaded in the widget areas on the page, and when a donor switches to another payment option the recaptcha box disappears.

Expected Behavior

I expect to have more than one form on the page, use a recaptcha, and let my donors switch between payment options, without it breaking.

Steps to Reproduce

  1. Load some extra forms into widget areas that display on every page.
  2. Configure a recaptcha on the forms
  3. Visit the form page in Firefox, and see that all of the recaptcha boxes appear.
  4. Change the payment option of the form, and see the recaptcha disappears.

Visuals

Screencast of the issue: https://screencast-o-matic.com/watch/cFivoEFPjP

Related

https://secure.helpscout.net/conversation/627983035/22196?folderId=1823994

Environment

WordPress System Info ### WordPress Environment ### Home URL: http://give.local Site URL: http://give.local WP Version: 4.9.7 WP Multisite: – WP Memory Limit: 256 MB WP Debug Mode: – WP Cron: ✔ Language: en_US Permalink Structure: /%postname%/ Show on Front: posts Table Prefix Length: wp_ Table Prefix Length: 3 Table Prefix Status: Acceptable Admin AJAX: Accessible Registered Post Statuses: publish, future, draft, pending, private, trash, auto-draft, inherit, request-pending, request-confirmed, request-failed, request-completed, wc-pending, wc-processing, wc-on-hold, wc-completed, wc-cancelled, wc-refunded, wc-failed, refunded, failed, revoked, cancelled, abandoned, processing, preapproval, give_subscription ### Server Environment ### Hosting Provider: DBH: localhost, SRV: give.local TLS Connection: Connection uses TLS 1.2 TLS Connection: Probably Okay Server Info: Apache/2.4.10 (Debian) PHP Version: 7.0.3 PHP Post Max Size: 1,000 MB PHP Time Limit: 900 PHP Max Input Vars: 3000 PHP Max Upload Size: 1,000 MB cURL Version: ❌ 7.38.0, OpenSSL/1.0.1t - We recommend a minimum cURL version of 7.40. SUHOSIN Installed: – MySQL Version: 5.6.34 Default Timezone is UTC: ✔ fsockopen/cURL: ✔ SoapClient: ✔ DOMDocument: ✔ gzip: ✔ GD Graphics Library: ✔ Multibyte String: ✔ Remote Post: ✔ Remote Get: ✔ ### Give Configuration ### Give Version: 2.1.7 Give Cache: Enabled Database Updates: All DB Updates Completed. Give Cache: Enabled Give Cache: ✔New Donation✔Donation Receipt❌New Offline Donation❌Offline Donation Instructions✔New User Registration✔User Registration Information✔Email access✔Daily Email Report✔Weekly Email Report✔Monthly Email Report❌Renewal Receipt Email✔Subscription Cancelled Email❌Subscription Completed Email✔Subscription Reminder Email✔Subscriptions Email Access Upgraded From: – Test Mode: Enabled Currency Code: GBP Currency Position: Before Decimal Separator: . Thousands Separator: , Success Page: http://give.local/donation-confirmation/ Failure Page: http://give.local/donation-failed/ Donation History Page: http://give.local/donation-history/ Give Forms Slug: /donations/ Enabled Payment Gateways: Test Donation, Stripe - Credit Card, PayPal Standard Default Payment Gateway: Stripe - Credit Card PayPal IPN Verification: Disabled PayPal IPN Notifications: N/A Donor Email Access: Enabled ### Session Configuration ### Give Use Sessions: Enabled Session: Disabled ### Active Give Add-ons ### Give - Authorize.net Gateway: ✔ Licensed – by WordImpress – 1.4.2 Give - CCAvenue Gateway: ✔ Licensed – by WordImpress – 1.0.1 Give - Email Reports: ✔ Licensed – by WordImpress – 1.1.2 Give - Form Field Manager: ✔ Licensed – by WordImpress – 1.3 Give - MailChimp: ✔ Licensed – by WordImpress – 1.4.1 Give - Manual Donations: ✔ Licensed – by WordImpress – 1.4.1 Give - PayPal Pro Gateway: ✔ Licensed – by WordImpress – 1.1.6 Give - Paytm Gateway: ❌ Unlicensed – by WordImpress – 1.0 Give - PDF Receipts: ❌ Unlicensed – by WordImpress – 2.3 Give - Recurring Donations: ✔ Licensed – by WordImpress – 1.7.1 Give - Stripe Gateway: ✔ Licensed – by WordImpress – 2.0.7 Give - Tributes: ✔ Licensed – by WordImpress – 1.5.0 ### Other Active Plugins ### Duplicate Post: by Enrico Battocchi – 3.2.2 Give - Hook Helper: by Ravinder Kumar – 1.0 Mailgun: by Mailgun – 1.5.11 Page Builder by SiteOrigin: by SiteOrigin – 2.7.3 Sam's Helper Function: by WordImpress – 1.0 User Role Editor: by Vladimir Garagulya – 4.44 WooCommerce: by Automattic – 3.4.4 WooCommerce Paytm Payment Gateway: by FTI Technologies – 1.0 ### Inactive Plugins ### Give - Fee Recovery: by WordImpress – 1.7.0 ### Active MU Plugins ### Bypass Login: by Stephen Carnam – 1.1.0 ### Theme ### Name: Twenty Seventeen Version: 1.6 Author URL: https://wordpress.org/ Child Theme: No – If you're modifying Give on a parent theme you didn't build personally, then we recommend using a child theme. See: How to Create a Child Theme
Operating System
  • Platform: Mac OS X
Browser
  • Name: Chrome

@mehul0810 commented on Mon Sep 24 2018

@samsmith89 I think reCaptcha for donation forms is not a built-in feature in Give Core right now. You can enable reCaptcha for only email access form. However, you can achieve the reCaptcha for donation forms using a code snippet (i.e. https://github.com/WordImpress/Give-Snippet-Library/blob/master/form-customizations/implement-recaptcha.php).

I've taken a quick look on this issue using the reCaptcha snippet and found that the snippet is having issue while switching payment gateway when there are multiple forms on the same page. This issue can be generated due to the fact that the user/developer of the site has copy-pasted the exact snippet and duplicated the reCaptcha ID. So, There is some sort of scope to improve the snippet using ID Prefix instead of Form ID. Hence, moving this issue to snippet library repository.

You can also refer to the open issue related to reCaptcha: https://github.com/WordImpress/Give/issues/1400

kevinwhoffman commented 6 years ago

@nishitlangaliya When you get to this issue, schedule a brief call with @mehul0810 since he has already looked into it and has an idea of the cause.

nishitlangaliya commented 6 years ago

Slack Call Summary

Participants: @nishitlangaliya , @mehul0810 Topic: Discussion regarding https://github.com/impress-org/give-snippet-library/issues/84 Result: We had discussed about multiple re-captcha issue as per above mention. And @mehul0810 give me idea about working with multiple give form using give-form-id-prefix so currently working on that.

kevinwhoffman commented 6 years ago

Iceboxing this for now as it is not a quick fix and has no current demand. The customer that originally asked for recaptcha support via Help Scout ticket is no longer using it. If we get requests for recaptcha on multiple forms on the same page, we may take another look but this is not a priority at the moment. Instead we are focusing on improved Akismet integration for spam detection in https://github.com/impress-org/give/issues/3768.

kevinwhoffman commented 6 years ago

@nishitlangaliya is going to add his findings to date so that we have that info logged for the future.

DevinWalker commented 4 years ago

Closing as this will be resolved when we complete: https://github.com/impress-org/givewp/issues/4353