You are here

function recaptcha_v3_captcha_validate in reCAPTCHA v3 7

CAPTCHA Callback; Validates the reCAPTCHA v3 code.

2 string references to 'recaptcha_v3_captcha_validate'
recaptcha_v3_captcha in ./recaptcha_v3.module
Implements hook_captcha().
recaptcha_v3_element_captcha_process_validate in ./recaptcha_v3.module
In case of failed recaptcha v3 token validation need to replace captcha validate callback in $element['#captcha_validate'] for displaying correct error message (otherwise will be executed replaced challenge validation with possible passed…

File

./recaptcha_v3.module, line 238
Verifies if user is a human without necessity to solve a CAPTCHA.

Code

function recaptcha_v3_captcha_validate($solution, $response, $element, &$form_state) {

  // Check validated previously result.
  if ($element['#recaptcha_v3_valid'] === TRUE) {
    return TRUE;
  }
  $message = variable_get('recaptcha_v3_error_message', t('Recaptcha verification failed.'));
  form_set_error('captcha_response', $message);
  return FALSE;
}