? Success
Pull Request for # 7921

User tests: Successful: Unsuccessful:

avatar Dekari
Dekari
24 Sep 2015

Pull request based on the issue tracked as zero-24 asked:

http://issues.joomla.org/tracker/joomla-cms/7921


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 - 24 Sep 2015
avatar Dekari Dekari - change - 24 Sep 2015
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 24 Sep 2015
Labels Added: ?
avatar zero-24 zero-24 - change - 24 Sep 2015
Category Plugins
avatar zero-24 zero-24 - change - 24 Sep 2015
The description was changed
Rel_Number 0 7921
Relation Type Pull Request for
Easy No Yes
avatar wojsmol
wojsmol - comment - 24 Sep 2015

@Dekari please see Dekari#2

avatar jissereitsma
jissereitsma - comment - 15 Apr 2016

@Dekari Forgive me if I'm wrong, but I think you are mistaken on the functionality of the Recaptcha plugin. The Google Recaptha plugin always relies on the code to be retrieved via the user response ($input->get('g-recaptcha-response', '', 'string');). In other words, the correct design of the Recaptcha plugin is to have a pointless $code argument to the event method onCheckAnswer() - in other words, the fact that the $code argument is not used, might seem wrong but it is not.

You might then wonder what is the point of having this argument $code to the method onCheckAnswer()? The reason is that this is a generic event, that other CAPTCHA mechanisms can also call upon. So for code compliance the argument is needed, for this specific plugin it is not.

avatar roland-d
roland-d - comment - 24 Jun 2016

@Dekari, I agree with @jissereitsma here. Let me know if you have another reason for this pull request. If no answer is received within 4 weeks, I will close this pull request. Thank you.


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

avatar roland-d roland-d - change - 24 Jun 2016
Status Pending Information Required
avatar brianteeman
brianteeman - comment - 21 Jul 2016

I am closing this PR at this time for the reasons previously stated. It can always be re-opened if required


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

avatar brianteeman brianteeman - change - 21 Jul 2016
Status Information Required Closed
Closed_Date 0000-00-00 00:00:00 2016-07-21 17:22:44
Closed_By brianteeman
avatar brianteeman brianteeman - close - 21 Jul 2016
avatar joomla-cms-bot joomla-cms-bot - change - 21 Jul 2016
Category Plugins Plugins Front End

Add a Comment

Login with GitHub to post a comment