Form submission breaks site when site key and secret not provided.

Created on 10 May 2021, over 3 years ago
Updated 11 March 2023, over 1 year ago

Problem/Motivation

When a site is configured with a form to use recaptcha_v3 without a site key or secret key. The form submission fails.

The website encountered an unexpected error. Please try again later.

RuntimeException: No secret provided in ReCaptcha\ReCaptcha->__construct() (line 136 of /var/www/html/vendor/google/recaptcha/src/ReCaptcha/ReCaptcha.php).
_recaptcha_v3_verify_captcha_response(Object, '') (Line: 222)
recaptcha_v3_validate('1', '', Array, Object) (Line: 501)
captcha_validate(Array, Object, Array)
call_user_func_array('captcha_validate', Array) (Line: 280)
Drupal\Core\Form\FormValidator->doValidateForm(Array, Object) (Line: 236)
...

Steps to reproduce

* Enable captcha & recaptcha_v3 module.
* Create an recaptcha v3 action.
* Add a captcha point for a form and set the captchaType to be Google reCAPTCHA V3.
* DO NOT ADD site key or site secret.
* Fill the form
* Submit the button.

Proposed resolution

This should either skip reCAPTCHA V3 validation or a form validation error should show like google reCaptcha v3 not configured properly or similar.

Remaining tasks

User interface changes

API changes

Data model changes

🐛 Bug report
Status

Fixed

Version

1.4

Component

Code

Created by

🇮🇳India JayKandari

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024