?
Referenced as Pull Request for: # 7940
avatar Dekari
Dekari
21 Sep 2015

Steps to reproduce the issue

Use recaptcha plugin in custom component. Use multiple instances of it so each instance has it's own input name.

When you call the recaptcha plugin to validate you can pass the $code to validate instead of the "standard" code from input.

see the function declaration: public function onCheckAnswer($code = null)

e.g.

$alldata = JFactory::getApplication()->input;
$cresponse = $alldata->get('grecaptcharesponse','','string'); //here we have the catcha code to validate

//call captcha plugin to validate code
JPluginHelper::importPlugin('captcha');
$dispatcher = JEventDispatcher::getInstance();

$res = $dispatcher->trigger('onCheckAnswer',$cresponse);

Expected result

A true validation of the $cresponce

Actual result

Always false

System information (as much as possible)

Joomla! 3.4.4 Stable [ Ember ] 8-September-2015 21:30 GMT
PHP: 5.4.43
Mysql: 5.5.42-37.1-log

Additional comments

The issue is on the onCheckReponse function of the captch plugin where has the $code param that your are able to pass but in true code the $code param is totally ignored.

I have a solution to propose that working ok:

in /plugins/captcha/recaptcha.php replace (about line 127):

$response = $input->get('g-recaptcha-response', '', 'string');

with:

if (!empty($code))
$response = $code;
else
$response = $input->get('g-recaptcha-response', '', 'string');

And issue will be solved.

thanks and i hope helped

christopher

avatar Dekari Dekari - open - 21 Sep 2015
avatar zero-24
zero-24 - comment - 23 Sep 2015

Hi :)

can you send your changes as pull request? The easy way is: https://docs.joomla.org/Using_the_Github_UI_to_Make_Pull_Requests

let me know if you need help with it.

avatar Dekari
Dekari - comment - 24 Sep 2015

Helo zero-24 i just made the pull request as u asked me.

Please inform me of any issues or questions

thanks!


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7921.

avatar zero-24 zero-24 - change - 24 Sep 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-09-24 13:06:47
Closed_By zero-24
avatar zero-24
zero-24 - comment - 24 Sep 2015

Closing as we have a PR here: #7940 Thanks @Dekari


This comment was created with the J!Tracker Application at issues.joomla.org/joomla-cms/7921.

avatar zero-24 zero-24 - close - 24 Sep 2015
avatar zero-24 zero-24 - close - 24 Sep 2015

Add a Comment

Login with GitHub to post a comment