malganis93 / brlrecaptcha Goto Github PK
View Code? Open in Web Editor NEWA ReCaptcha v2.0 module for ZF2 (Zend Framework 2)
License: MIT License
A ReCaptcha v2.0 module for ZF2 (Zend Framework 2)
License: MIT License
There are a light and a dark theme for reCaptcha....
i have an error when i reloading page.
Notice: Undefined index: error-codes in vendor/browserlife/zf2-recaptcha/src/BrlReCaptcha/Service/ReCaptchaService.php on line 175
Warning: implode(): Invalid arguments passed in vendor/browserlife/zf2-recaptcha/src/BrlReCaptcha/Service/ReCaptchaService.php on line 175
I am using the ZfcUser module in my modules directory
and in the zfcuser.global.php I am using the
'use_registration_form_captcha' => true,
with the parameters
'form_captcha_options' => array(
'class' => 'BrlReCaptcha\ReCaptcha',
'options' => array(
'wordLen' => 2,
'expiration' => 300,
'timeout' => 300,
),
),
In the BrlReCaptcha\Helper\ReCaptcha.php
I kinda cheated and declared the variable
$pubkey = 'My-Public_Key';
in
public function render(ElementInterface $element)
{
for the line
$html = '<\div class="g-recaptcha" data-sitekey="'.$pubkey.'" data-theme="'.$theme.'"></\div>';
....
}
Just to make the ReCaptcha show on the registration page correctly, but it does not validate when Register is executed. I know this is because the "confirmation data" is not being passed so I know that I have to do your next steps.
I do not understand where to put:
$element = new \Zend\Captcha\Captcha('g-recaptcha-response');
$element->setCaptcha(new BrlReCaptcha\ReCaptcha(array('private_key' => 'YOUR_SECRET FROM GOOGLE', 'public_key' => 'YOUR_PUBLIC_KEY', 'theme' => 'dark')));
$form->add($element);
is it in the register.phtml or in the controller or the Base.php or Register.php form??
I have tried everything and I get no results or errors.
Also where the element needs to be added to the validation chain is a mystery.
Can you please give the code example for these steps.
Much appreciated.
We have an issue as you can see on the backtrace below :
BrlReCaptcha\Service\ReCaptchaService::verifyApiResponse() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/browserlife/zf2-recaptcha/src/BrlReCaptcha/Service/ReCaptchaService.php: 175
BrlReCaptcha\Service\ReCaptchaService::verify() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/browserlife/zf2-recaptcha/src/BrlReCaptcha/Service/ReCaptchaService.php: 128
BrlReCaptcha\Service\ReCaptchaService::isValid() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/browserlife/zf2-recaptcha/src/BrlReCaptcha/ReCaptcha.php: 176
BrlReCaptcha\ReCaptcha::isValid() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/zendframework/zendframework/library/Zend/Validator/ValidatorChain.php: 243
Zend\Validator\ValidatorChain::isValid() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/zendframework/zendframework/library/Zend/InputFilter/Input.php: 337
Zend\InputFilter\Input::validateInputs() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/zendframework/zendframework/library/Zend/InputFilter/BaseInputFilter.php: 252
Zend\InputFilter\InputFilter::isValid() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/zendframework/zendframework/library/Zend/InputFilter/BaseInputFilter.php: 207
Zend\InputFilter\InputFilter::isValid() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/zendframework/zendframework/library/Zend/Form/Form.php: 512
Application\Common\Form\Register::registerAction() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/module/Application/src/Application/Frontoffice/Controller/AuthController.php: 235
Application\Frontoffice\Controller\AuthController::onDispatch() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php: 82
Application\Frontoffice\Controller\AuthController::onDispatch()
Zend\EventManager\EventManager::triggerListeners() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php: 444
Zend\EventManager\EventManager::trigger() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php: 205
Zend\EventManager\EventManager::dispatch() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php: 118
Application\Frontoffice\Controller\AuthController::onDispatch() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php: 93
Zend\Mvc\DispatchListener::onDispatch()
Zend\EventManager\EventManager::triggerListeners() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php: 444
Zend\EventManager\EventManager::trigger() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php: 205
Zend\EventManager\EventManager::run() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php: 314
main() at /usr/local/zend/var/apps/http/app.assessfirst.com/80/4_151/public/index.php: 19
It seems to be inside this code :
//get the status
if ($content['success'] == true) {
return true;
} else {
//TODO: One or more codes at ones?
$this->setErrorCode(implode(',', $content['error-codes']));
return false;
}
The content variable is empty, so the implode generate a warning.
Hi
I implemented the module in my Zf2 Application but irrespective of whether I complete the captcha or not it always throws out "Value is required and can't be empty". Could you help?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.