Skip to content

zz/yiiReCaptcha

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 

Repository files navigation

YiiReCaptcha

Based on reCaptcha API 2.0

Quick Start

You can clone the github repo and get the full codebase to build the distributive something you want.

Installation

  • 1/ Download GitHub repo (dakiquang/yiiReCaptcha) and extract files into a destination folder(extensions folder/vendor folder or any folder in your structure)

  • 2/ Sign up for an reCAPTCHA API keys on Google reCaptcha. and get the key/secret pair

  • 3/ Configure this component in your configuration file (main.php file). The parameters siteKey and secret are required.

'components' => [
    'reCaptcha' => [
        'name' => 'reCaptcha',
        'class' => '<path-to-destination-folder>\yiiReCaptcha\ReCaptcha',
        'key' => '<your-key>',
        'secret' => '<your-secret>',
    ],
    ...

4/ Add ReCaptchaValidator in your model, for example:

    public $verifyCode;

    public function rules()
    {
        return array(
            array('verifyCode', 'required'),
            array('verifyCode', '<path-to-destination-folder>.yiiReCaptcha.ReCaptchaValidator'),
        );
    }

5/ Usage this widget in your view

<?php
$this->widget('<path-to-destination-folder>.yiiReCaptcha.ReCaptcha', array(
    'model'     => $model,
    'attribute' => 'verifyCode',
));
?>

6/ Use for multiple domain: By default, the reCaptcha is restricted to the specified domain. Use the secure token to request a CAPTCHA challenge from any domain. Adding more attribute 'isSecureToken' => true to setup for any domain:

<?php
$this->widget('<path-to-destination-folder>.yiiReCaptcha.ReCaptcha', array(
    'model'     => $model,
    'attribute' => 'verifyCode',
    'isSecureToken' => true,
));
?>

END.

About

Google reCAPTCHA widget for yii1

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PHP 100.0%