recaptcha v2 not work
amidevous opened this issue · comments
recaptcha v2 has not worked for several days it returns
Google reCAPTCHA verification failed! Please try again.
I check the secret and secret key are correct the box and tick and green
and yet it returns this error
ok solved google change method get by post
change code
$rGA = new PHPGangsta_GoogleAuthenticator();
if ((isset($_POST["username"])) && (isset($_POST["password"]))) {
if ($rAdminSettings["recaptcha_enable"]) {
$rResponse = json_decode(file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$rAdminSettings["recaptcha_v2_secret_key"].'&response='.$_POST['g-recaptcha-response']), True);
if ((!$rResponse["success"]) && (!in_array("invalid-input-secret", $rResponse["error-codes"]))) {
$_STATUS = 5;
}
}
by
$rGA = new PHPGangsta_GoogleAuthenticator();
if ((isset($_POST["username"])) && (isset($_POST["password"]))) {
if ($rAdminSettings["recaptcha_enable"]) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.google.com/recaptcha/api/siteverify");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, 'secret='.$rAdminSettings["recaptcha_v2_secret_key"].'&response='.$_POST['g-recaptcha-response']);
$response = curl_exec($ch);
curl_close($ch);
$rResponse = json_decode($response, True);
if ((!$rResponse["success"]) && (!in_array("invalid-input-secret", $rResponse["error-codes"]))) {
$_STATUS = 5;
}
}