Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site key and secret key must be specified. #18

Open
Lancer-Serega opened this issue Jul 14, 2017 · 1 comment
Open

Site key and secret key must be specified. #18

Lancer-Serega opened this issue Jul 14, 2017 · 1 comment

Comments

@Lancer-Serega
Copy link

Lancer-Serega commented Jul 14, 2017

I get this:

Site key and secret key must be specified.

Can you help me, please?

modules/default/forms/Registration.php
$this->addElement(new \Cgsmith\Form\Element\Recaptcha());

configs/application-local.php

return [
    'recaptcha' => [
        'sitekey' => 'my site key',
        'secretkey' => 'my secret key',
    ]
];

modules/default/Bootstrap.php

public function _initView()
    {
        $view = new Zend_View();

        $view->addHelperPath(
            APPLICATION_PATH . '/../vendor/cgsmith/zf1-recaptcha-2/src/Cgsmith/View/Helper',
            'Cgsmith\\View\\Helper\\'
        );

        Zend_Controller_Action_HelperBroker::addHelper(new Zend_Controller_Action_Helper_ViewRenderer($view));

        return $view;
    }

    public function _initRecaptcha()
    {
        $config = \Zend_Registry::get('appConfig');
        $params = $config->recaptcha->toArray();

        $params['messageTemplates'] = [
            \Cgsmith\Validate\Recaptcha::INVALID_CAPTCHA => 'The captcha was invalid', // set custom/translated message
            \Cgsmith\Validate\Recaptcha::CAPTCHA_EMPTY => 'The captcha must be completed'
        ];

        \Zend_Registry::set('recaptcha', $params);
    }

@cgsmith
Copy link
Owner

cgsmith commented Jul 17, 2017

Try this:

return [
    'recaptcha' => [
        'siteKey' => 'your site key',
        'secretKey' => 'your secret key',
    ]
];

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants