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

success = true does not indicate if submission was a bot #1

Open
lowedown opened this issue Oct 10, 2020 · 1 comment
Open

success = true does not indicate if submission was a bot #1

lowedown opened this issue Oct 10, 2020 · 1 comment

Comments

@lowedown
Copy link

lowedown commented Oct 10, 2020

Be aware that the concept of ReCaptcha V3 is completely different than previous versions. success = true only states whether this request was a valid reCAPTCHA token for your site. It doesn't say anything about the request being sent by a bot or a human. You will have to take $res['score'] into account for this. Example:

$scoreThreshold = 0.5; // 1.0 is very likely a good interaction, 0.0 is very likely a bot

if($res['success'] == true && $res['score'] > $scoreThreshold ) {

	// Perform you logic here for ex:- save you data to database
	echo '<div class="alert alert-success">
			<strong>Success!</strong> Your inquiry successfully submitted.
		  </div>';
} else {
	echo '<div class="alert alert-warning">
			  <strong>Error!</strong> You are not a human.
		  </div>';
}

You will have to find the ideal scoreThreshold for your application by looking at the admin console. The docs suggest starting at 0.5.
See recaptcha v3 docs for details.

@hudsantos
Copy link

Very good heads up @lowedown thank you very much.

Also here and here we can see how well known/popular contact-form-7 WordPress plugin also evaluates the response score using the default recommended threshold of 0.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

2 participants