Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

recaptcha v2 not work #90

Open
amidevous opened this issue Apr 10, 2021 · 1 comment
Open

recaptcha v2 not work #90

amidevous opened this issue Apr 10, 2021 · 1 comment

Comments

@amidevous
Copy link

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

@amidevous
Copy link
Author

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;
		}
	}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant