mumunotes

  • Home
  • Contact Us

Friday, 12 June 2015

Implementation google reCAPTCHA on Yii2 Application with Widget

 mumunotesss     14:12     Yii, Yii2     No comments   

Assalamualaikum Wr. Wb. Hello everybody...:D.
I published tutorial how to implementation captcha on Yii2, and then I will publish again my tutorial how to implementation google reCAPTCHA on Yii2 application with widget.
Fisrt, please run this code with composer :
      php composer.phar require --prefer-dist "himiklab/yii2-recaptcha-widget" "*"
or open your composer.json file and to require section :
    "himiklab/yii2-recaptcha-widget" : "*"
Run the composer update.
Second, Sign up for an reCAPTCHA API keys.
Now, you had site key and secret key.
The third, please open your LoginForm model class, and change with following code bellow :
public function rules(){
  return [
      [['username', 'password'], 'required'],
      ['rememberMe', 'boolean'],
      ['captcha',\himiklab\yii2\recaptcha\ReCaptchaValidator::className(), 'secret' => 'your screet code'],
      ['password', 'validatePassword'],
   ];
}
The fourth, open your login.php file in views/site directory and add the code bellow :
<?= $form->field($model, 'captcha')->widget(
        \himiklab\yii2\recaptcha\ReCaptcha::className(),
        ['siteKey' => 'Your sitekey']
    ) ?>
Now, we will trial the yii2basic application. Please open your browser and access this link "http://localhost/yii2basic/web/index.php?r=site/login"



 Now, your Yii2 appliaction have been implemented google reCAPTCHA...:D. So good luck. Wassalamualaikum Wr. Wb.
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

About Me

mumunotesss
View my complete profile

Popular Posts

  • Change password with validation and repeat password on Yii2
    Hello everybody. I could not post an article because I didn't have new knowledge to share. Ok, this day I will share about "...
  • Import Data from CSV File to Database Without Extension in Yii2
    Hello everybody, Assalamualaikum Wr. Wb. Nearly 1 month I don't publish article. Now, I publish an article about " Import Data fro...
  • Membuat login Yii2 dengan Database
    Selamat pagi guys. Sorry beberapa hari kamaren sibuk. Jadi belum sempet update blog lagi. Mumpung kali ini sempet, hari ini mau berbagi te...
  • Membuat fungsi CRUD dengan Gii Yii2
    Selamat pagi guys. Setelah kemaren kita membuat login dari database, hari ini kita akan membuat CRUD (create, read, update, delete) dengan ...

Blog Archive

  • ▼  2015 (16)
    • ►  November (1)
    • ►  September (1)
    • ►  August (1)
    • ▼  June (8)
      • Upload File or Image on Yii2
      • Implementation google reCAPTCHA on Yii2 Applicati...
      • Implementation Captcha on Yii2
      • Change password with validation and repeat passwor...
      • Membuat Alert atau Notifikasi di Yii2
      • ACF (Access Control Filter) Yii2 dengan Role dari ...
      • Membuat fungsi CRUD dengan Gii Yii2
      • Membuat login Yii2 dengan Database
    • ►  May (5)

Translate

Copyright © mumunotes
Distributed By My Blogger Themes | Blogger Theme By NewBloggerThemes