Problem/Motivation

When Recaptcha V3 fail, it takes ~40 seconds to submit the form after clicking the submit button. There is an error in drupal log stating:

Google reCAPTCHA v3 validation failed: The response parameter is invalid or malformed. Expected hostname did not match. Expected action did not match.

When hitting the submit button, I can see in chrome "waiting for www.google.com..." and tab loader is just spinning. No errors are visible to end-user and in the end form is being submitted.

CommentFileSizeAuthor
#2 2021-08-31_18-24.png494.24 KBdench0
#2 2021-08-31_18-13.png22.38 KBdench0

Comments

lubwn created an issue. See original summary.

dench0’s picture

StatusFileSize
new22.38 KB
new494.24 KB

it takes ~40 seconds to submit the form after clicking the submit button

how I understand from the description - the form are submitted by ajax or maybe some other js code blocking from submitting (because otherwise, the form submission should happen immediately).
ReCaptcha V3 does not bind any event listeners on the form `submit` or button `click` events. And event more recaptcha js code can't block form submitting in any way. So you need to find out what really happens when you submit the form using browser developer tools and js debugging.

Expected hostname did not match

- you need to check if the `Domains` setting is correct in the google recaptcha admin page, see attached screenshot #1.

Expected action did not match

- ps show me markup of the recaptch element, see attached screenshot #2

lubwn’s picture

Thank you for a quick response.

It is actually /user/register form. It is not a form submitted by JS. I checked domains and it is set correctly.

I am attaching the markup:

<div data-drupal-selector="edit-captcha" aria-describedby="edit-captcha--description" class="captcha">
<input data-drupal-selector="edit-captcha-sid" type="hidden" name="captcha_sid" value="9050">
<input data-drupal-selector="edit-captcha-token" type="hidden" name="captcha_token" value="uHJFWBBwYo1Jn0gxP9-YazYW14pqxjk5SfRtyMqztYw">
<input id="recaptcha-v3-token" class="recaptcha-v3-token" data-recaptcha-v3-action="captcha_v3" data-recaptcha-v3-site-key="6Lf8Ki0bAAAAANmv83eVXDfl-gy1tvVudsPU6mRF" data-drupal-selector="edit-captcha-response" type="hidden" name="captcha_response" value="03AGdBq25W0iw6C9EFa_xJwCNiS9HWcvA7DT0pm4EgyN2TXuNF_QwBQGtviaTydpUCoEsmraOg0vRF0E0uX8Rw5JNh7pwpX51480Opa6LoFoJTUSggzUuR4wZfXv4F3dkuHRwTjT-b4ZIpAJh5YWUD5Pji818Ml1VtBB73aXbUSOWsnL0IK8_9hWfwt9KpAubRk4hDWdU9e83sYoDA95UJw4ETfxfBPf1kNFtvx-u2dvDx75Hyy1daYcXguIuepw9ix4idUafjlBzYL4EZLbi2EaFszzsP_int62LWLYfMdrMK_nWQGx7Z3ibAlfteKo-1kxGq6x6yBJwgx7y43UE2OvEJZlEhn0XzpIzco-MHyxFvo9B8jqT7uCy-kKuvTnvPvMTSawGh6G2tQmpc_DRoKa2fEg0H4cTEaA89BuXObly3l8ACY0ONwsPhC2twlMd9JzFkpTRVm45H">
<input data-drupal-selector="edit-is-recaptcha-v3" type="hidden" name="is_recaptcha_v3" value="1">
</div>
lubwn’s picture

False alarm! I know what makes this.. it is a custom module checking an access code during registration process!! There are ~4000 codes and the query is slowing down the site when registering. I will re-work the implementation but it has nothing to do with recaptcha. I thought it is something to do with recaptcha because of same-time implementation of both recaptcha and access codes to our website and error in drupal log pointed to this.

dench0’s picture

False alarm!

So if the issue is solved, then pls close it. Or do you still have problems with the ReCaptcha?

lubwn’s picture

Status: Active » Closed (works as designed)