ReCaptcha throws out configuartion error

Hi guys,following Code throws out error like this:

"ERROR for site owner: Invalid site key"

I have absolutely no idea, how to fix this. any help possible?

Here is my configfile:




return [

    'aliases' =>

    [

        '@uploadedfilesdir' => '@app/mails',

        '@uploading' => '@app/uploadedfiles'

    ],

    'components' => [

        'reCaptcha' => [

            'name' => 'reCaptcha',

            'class' => 'himiklab\yii2\recaptcha\ReCaptcha',

            'siteKey' => 'siteKey',

            'secret' => 'secret key'

        ],

        'mailer' => [

            'class' => 'yii\swiftmailer\Mailer',

        ],

        'urlManager' => [

            'class' => 'yii\web\UrlManager',

            'enablePrettyUrl' => true,

            'showScriptName' => true,

            'enableStrictParsing' => true,

            'rules' => [

                '/' => 'site/index',

                'reset' => 'site/request-password-reset',

                'login' => 'site/login',

                'contact' => 'site/contact',

                'logout' => 'site/logout',

                'signup' => 'site/signup',

                'formular' => 'site/script',

                'praktikum' => 'bewerbungen/index',

                '<controller:\w+>/<id:\d+>' => '<controller>/view',

                '<controller:\w+>/<action:\w+>/<id:\d+>' => '<controller>/<action>',

                'country' => 'country/index'

            ],

        ],

        'db' => [

            'class' => 'yii\db\Connection',

            'dsn' => 'mysql:host=localhost;dbname=yii2_widget',

            'username' => 'root',

            'password' => '',

            'charset' => 'utf8',

        ],

    ],

];

?>



Here is my model:




<?php


namespace frontend\models;


use Yii;

use yii\base\Model;


/**

 * ContactForm is the model behind the contact form.

 */

class ContactForm extends Model {


    public $name;

    public $email;

    public $subject;

    public $body;

    public $reCaptcha;


    /**

     * @inheritdoc

     */

    public function rules() {

        return [

            [['name', 'email', 'subject', 'body'], 'required'],

            ['email', 'email'],

            ['reCaptcha', \himiklab\yii2\recaptcha\ReCaptchaValidator::className(), 'secret' => '6LeTXQgUAAAAALExcpzgCxWdnWjJcPDoMfK3oKGi']

        ];

    }


    public function attributeLabels() {

        return['reCaptcha' => '',];

    }


    public function sendEmail($email) {

        return Yii::$app->mailer->compose()

                        ->setTo($email)

                        ->setFrom([$this->email => $this->name])

                        ->setSubject($this->subject)

                        ->setTextBody($this->body)

                        ->send();

    }


}



And here is my Formular:





$this->title = 'Contact';

$this->params['breadcrumbs'][] = $this->title;

?>

<div class="site-contact">

    <h1><?= Html::encode($this->title) ?></h1>


    <p>

        If you have business inquiries or other questions, please fill out the following form to contact us. Thank you.

    </p>


    <div class="row">

        <div class="col-lg-5">

            <?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>


                <?= $form->field($model, 'name')->textInput(['autofocus' => true]) ?>


                <?= $form->field($model, 'email') ?>


                <?= $form->field($model, 'subject') ?>


                <?= $form->field($model, 'body')->textarea(['rows' => 6]) ?>


             <?= $form->field($model, 'reCaptcha')->widget(\himiklab\yii2\recaptcha\ReCaptcha::className()) ?>


                <div class="form-group">

                    <?= Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?>

                </div>


            <?php ActiveForm::end(); ?>

        </div>

    </div>


</div>



Did you set the actual values to ‘siteKey’ and ‘secret’?

I’m not familiar with reCAPTCHA, but I think they should be customized according to your reCAPTCHA account.

Yes, I did. I changed values of sitekey and secret according of values given by google!

It looks like some things need to be adjusted in the ‘rules/validator’ section of the controller according to the GitHub site