55 $this->
message =
"The code you entered did not match. Please try again.";
56 $this->compareField =
"recaptcha_response_field";
57 $this->
title =
"Captcha";
59 $this->AbstractValidator(
"recaptcha_user_answer",
"Captcha");
71 if ($this->readOnly)
return "";
75 if (!isset(
$_POST[
"g-recaptcha-response"]) ||
$_POST[
"g-recaptcha-response"] === $this->empty)
77 return "{$this->title} is a required field.";
80 $data = array(
"secret" => $secret_key,
81 "response" =>
$_POST[
"g-recaptcha-response"],
82 "remoteip" => $_SERVER[
"REMOTE_ADDR"]);
87 return "CAPTCHA failed";
99 parent::__construct(
$form);
101 $this->
field =
"captcha";
107 if(!$site_key || !$secret_key)
109 throw new FakoliException(
"reCAPTCHA v2 keys must be provided in CMS Application Settings.");
120 <script src=
'https://www.google.com/recaptcha/api.js'></script>
130 $this->_startField(
$field);
132 <div
class=
'captcha_wrapper'>
133 <div
class=
"g-recaptcha" data-sitekey=
"<?echo $site_key?>"></div>
FakoliException is the base exception class for all Fakoli errors.
static usingFeature()
Uses the specified framework feature(s).
static using()
Import the datamodels, views and manifest for the specified component(s).
__construct()
We do not receive parameters for this validator because the field names for retrieving values in $_PO...
$compareField
The field where the turing test id will be set in $_POST; controlled by hello captcha creator.
static getValue($component, $name)
Retrieve the value of the specified Setting.
if(! $user) if(! $response_id) $response