User tests: Successful: Unsuccessful:
Pull request based on the issue tracked as zero-24 asked:
http://issues.joomla.org/tracker/joomla-cms/7921
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);
A true validation of the $cresponce
Always false
Joomla! 3.4.4 Stable [ Ember ] 8-September-2015 21:30 GMT
PHP: 5.4.43
Mysql: 5.5.42-37.1-log
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
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Category | ⇒ | Plugins |
Rel_Number | 0 | ⇒ | 7921 |
Relation Type | ⇒ | Pull Request for | |
Easy | No | ⇒ | Yes |
@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.
@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.
Status | Pending | ⇒ | Information Required |
I am closing this PR at this time for the reasons previously stated. It can always be re-opened if required
Status | Information Required | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-07-21 17:22:44 |
Closed_By | ⇒ | brianteeman |
Category | Plugins | ⇒ | Plugins Front End |
@Dekari please see Dekari#2