You are here

function recaptcha_v3_captcha in reCAPTCHA v3 7

Same name and namespace in other branches
  1. 8 recaptcha_v3.module \recaptcha_v3_captcha()

Implements hook_captcha().

File

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

Code

function recaptcha_v3_captcha($op, $captcha_type = '', $captcha_sid = NULL) {
  switch ($op) {
    case 'list':
      $actions = _recaptcha_v3_get_all_actions();
      return array_keys($actions);
    case 'generate':
      $captcha['form']['recaptcha_v3_token'] = recaptcha_v3_token_element($captcha_type);
      $captcha['form']['captcha_response'] = array(
        '#type' => 'hidden',
        '#value' => 'Google recaptcha v3',
      );
      $captcha['solution'] = TRUE;
      $captcha['captcha_validate'] = 'recaptcha_v3_captcha_validate';
      $captcha['cacheable'] = TRUE;
      return $captcha;
  }
}