Skip to content
This repository has been archived by the owner on Nov 28, 2019. It is now read-only.

Commit

Permalink
BUGFIX More graceful response to new 'invalid-request-cookie' error i…
Browse files Browse the repository at this point in the history
…n Recaptcha (fixes #2)
  • Loading branch information
chillu committed Sep 1, 2011
1 parent 9235a28 commit 59034ab
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion code/RecaptchaField.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,9 @@ public function validate($validator) {
list($isValid, $error) = explode("\n", $response, 2);

if($isValid != 'true') {
if(trim($error) != 'incorrect-captcha-sol') {
// Count some errors as "user level", meaning they raise a validation error rather than a system error
$userLevelErrors = array('incorrect-captcha-sol', 'invalid-request-cookie');
if(!in_array(trim($error), $userLevelErrors)) {
user_error("RecatpchaField::validate(): Recaptcha-service error: '{$error}'", E_USER_ERROR);
return false;
} else {
Expand Down

0 comments on commit 59034ab

Please sign in to comment.