Giter VIP home page Giter VIP logo

brlrecaptcha's People

Contributors

malganis93 avatar tdutrion avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

brlrecaptcha's Issues

Undefined index: error-codes

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

How to Integrate with Registration Form for ZfcUser

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.

implode(): Invalid arguments passed

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.

Not working

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.