johnson/yii2-pattern-captcha

Yii2 pattern captcha is nine dots based pattern Captcha to match with the numbers given in the box

v0.0.2 2019-06-15 20:25 UTC

This package is not auto-updated.

Last update: 2024-04-14 20:22:14 UTC


README

yii2-pattern-captcha is a extension for Yii Framework version above 2.0.0 and it's new version of captcha or puzzle to solve smaller problems in order to make the web application is accessed by human.

Steps to follow.

Install via composer

composer require johnson/yii2-pattern-captcha

Then In your form

<?=
	JayPattern::widget([
	'ajaxUrl' => 'http://localhost/yii2-basic/web/index/login',
	'name' => 'pattern'
	]);
?>

System will generate the dynamic numbers and the users need to draw pattern without releasing the mouse button!. Each single swipe or touch will be considered as pattern submission.

Parameters

  • ajaxUrl - the verification call will be made to this URL
  • name - the input field that will be amended in the widget. Later you can verify if the value of the input given by you has empty value then the captcha failed or if it has value as true then captcha has been passed.

The selector may be like this ===> input[name="< your-given-name >']

In your Controller

if (Yii::$app->request->isPost) {
            $jp = new \Johnson\JayPattern();
            
            echo json_encode($jp->verifyCode());
            Yii::$app->end();
 }

Please do your comments about improvements and other stuffs.