Answer the question
In order to leave comments, you need to log in
How to use reCaptcha in yii2?
I am using the library https://github.com/himiklab/yii2-recaptcha-widget
In the model:
class MyClass extends \yii\db\ActiveRecord
{
public $reCaptcha;
public function rules()
{
return [
[['reCaptcha'], \himiklab\yii2\recaptcha\ReCaptchaValidator::className(),
'secret' => 'secretkey',
'uncheckedMessage' => 'Пожалуйста, подтвердите, что вы не робот.']
];
}
<?= $form->field($model, 'reCaptcha')->widget(\himiklab\yii2\recaptcha\ReCaptcha::className()) ?>
<?php echo $captcha ?
$form->field($model, 'reCaptcha')->widget(\himiklab\yii2\recaptcha\ReCaptcha::className()) : " " ?>
["reCaptcha"]=>
array(1) {
[0]=>
string(55) "Неправильный проверочный код."
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question