/** * Check value with rule * Returns: * - true if rule passed. * - false if value doesn`t match the rule. * * @param mixed $value * @return bool */ public function check($value) { $reCaptcha = \Magelight\Webform\Models\Captcha\ReCaptcha::forge(); $request = \Magelight\Http\Request::getInstance(); $challenge = $request->getPost(\Magelight\Webform\Models\Captcha\ReCaptcha::CHALLENGE_INDEX); $response = $request->getPost(\Magelight\Webform\Models\Captcha\ReCaptcha::RESPONSE_INDEX); return $reCaptcha->recaptchaCheckAnswer($_SERVER['HTTP_HOST'], $challenge, $response)->is_valid; }
/** * Get captcha HTML code * * @return string */ public function toHtml() { return $this->reCaptchaModel->recaptchaGetHtml(); }