Skip to content

Commit

Permalink
Update recaptcha.php
Browse files Browse the repository at this point in the history
Pull request based on the issue tracked as zero-24 asked:

http://issues.joomla.org/tracker/joomla-cms/7921
  • Loading branch information
Dekari committed Sep 24, 2015
1 parent dde0af6 commit d228d56
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions plugins/captcha/recaptcha/recaptcha.php
Expand Up @@ -118,13 +118,25 @@ public function onCheckAnswer($code = null)
{
case '1.0':
$challenge = $input->get('recaptcha_challenge_field', '', 'string');
$response = $input->get('recaptcha_response_field', '', 'string');

//We check the override $code param
if (!empty($code))
$response = $code;
else
$response = $input->get('recaptcha_response_field', '', 'string');

$spam = ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0);
break;
case '2.0':
// Challenge Not needed in 2.0 but needed for getResponse call
$challenge = null;
$response = $input->get('g-recaptcha-response', '', 'string');

//We check the override $code param
if (!empty($code))
$response = $code;
else
$response = $input->get('g-recaptcha-response', '', 'string');

$spam = ($response == null || strlen($response) == 0);
break;
}
Expand Down

0 comments on commit d228d56

Please sign in to comment.