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
Helo zero-24 i just made the pull request as u asked me.
Please inform me of any issues or questions
thanks!
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2015-09-24 13:06:47 |
Closed_By | ⇒ | zero-24 |
Closing as we have a PR here: #7940 Thanks @Dekari
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.