Problem/Motivation

Make it possible to use reCAPTCHA globally , for countries where google.com domain isn't allowed use recaptcha.net.
See https://developers.google.com/recaptcha/docs/faq#can-i-use-recaptcha-glo...

Steps to reproduce

Try to use reCAPTCHA from country where google.com domain isn't allowed, f.e. China

Proposed resolution

Follow recommendation of Uncle Google and use recaptcha.net domain to load api.js and verify response.

User interface changes

Add new configuration option at /admin/config/services/simple_recaptcha
This should be a checkbox allowing to override default URL of recaptcha JS / siteverify endpoint.

API changes

Tweak simple_recaptcha_library_info_build() and serve JS from google.com or recaptcha.net depending on module configuration:
https://git.drupalcode.org/project/simple_recaptcha/-/blob/8.x-1.x/simpl...

In SimpleReCaptchaFormManager update validateCaptchaToken method and depending on config send verification request to:
https://www.google.com/recaptcha/api/siteverify
or:
https://www.recaptcha.net/recaptcha/api/siteverify

Comments

sandboxpl created an issue. See original summary.

  • sandboxpl committed 9e165e1 on 8.x-1.x
    Issue #3174056 by sandboxpl: Make it possible to use reCAPTCHA globally
    
sandboxpl’s picture

Status: Active » Fixed

This is ready and includes following changes:
* Added "recaptcha_use_globally" config entry and a checkbox on settings page , defaults to false, so no mix ups with upgrade path
* Serve reCAPTCHA api.js file form recaptcha.net domain when the configuration option is selected
* Also verify reCAPTCHA responses via https://www.recaptcha.net/recaptcha/api/siteverify when the option is selected
* Added some basic test to make sure that api.js is loaded from recaptcha.net

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.