User tests: Successful: Unsuccessful:
Pull Request for Issue #21643 .
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);
Setting | Value
PHP Built On | Windows NT DESKTOP-I8R3T2F 10.0 build 17134 (Windows 10) AMD64
Database Type | mysql
Database Version | 5.5.45
Database Collation | utf8_general_ci
Database Connection Collation | utf8mb4_general_ci
PHP Version | 7.2.7
Web Server | Microsoft-IIS/10.0
WebServer to PHP Interface | cgi-fcgi
Joomla! Version | Joomla! 3.8.11 Stable [ Amani ] 31-July-2018 14:00 GMT
Joomla! Platform Version | Joomla Platform 13.1.0 Stable [ Curiosity ] 24-Apr-2013 00:00 GMT
true if vaild
false if faild
Always False
if params $code
not empty $respone = $code
if send params get g-recaptcha-response
$respone = $input->get('g-recaptcha-response', '', 'string');
else $response = '';
Status | New | ⇒ | Pending |
Category | ⇒ | Front End Plugins |
this Pull Request needs 2 successfully Tests (not by Developer of PR). Than decide Maintaners if merged or not.
Thats the Standard-Procedere for Pull Requests.
Labels |
Added:
?
|
I have tested this item
Successfully tested with reCaptcha and the new implemented reCaptcha invisible plugins, as follows :
Install this patch and the another one : PR #22270
Test the code posted in jcomments.ajax.php :
$jinput = JFactory::getApplication()->input;
$post = $jinput->getArray($_POST);
$code = $post["g_recaptcha_response"]; //here we have the captcha code to validate
JPluginHelper::importPlugin('captcha', "recaptcha_invisible");
$dispatcher = JEventDispatcher::getInstance();
try
{
$res = $dispatcher->trigger('onCheckAnswer',$code);
}
catch (Exception $e)
{
self::showErrorMessage($e->getMessage());
$response->addScript("grecaptcha.reset()");
return $response;
}
@oleg-kosarev , please add changes to :
@oleg-kosarev can you make the changes @twister65 suggested at #21651 (comment)?
I suggest to close this PR due the lack of response by @oleg-kosarev or @twister65 can make the changes? In the meantime i add the label "needs new owner".
@twister65 can you apply the changes or should this Pull Request be closed?
@franz-wohlkoenig , I think you can close this PR because the user code is not necessary for the implementation of recaptcha:
I'm waiting for a new PR that implements ajax support in the recaptcha plugin.
Closed as stated above.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2019-07-27 14:47:26 |
Closed_By | ⇒ | franz-wohlkoenig |
@franz-wohlkoenig This error will be fixed in joomla 3.8.12?