giannisdag/yii2-check-login-attempts
最新稳定版本:v1.1.2
Composer 安装命令:
composer require giannisdag/yii2-check-login-attempts
包简介
Disable login after multiple failures.
关键字:
README 文档
README
this is a checker for login attempts
based on https://github.com/ethercreative/yii2-login-attempts-behavior
Installation
The preferred way to install this extension is through composer. Either run
composer require giannisdag/yii2-check-login-attempts
or add
"giannisdag/yii2-check-login-attempts": "*"
to the require section of your composer.json file.
Usage
Run the following migration
php yii migrate --migrationPath="@vendor/giannisdag/yii2-check-login-attempts/src/migrations" --interactive=0
Add the behavior to your login model
public function behaviors() { $behaviors = parent::behaviors(); $behaviors[] = [ 'class' => '\giannisdag\yii2CheckLoginAttempts\behaviors\LoginAttemptBehavior', // Amount of attempts in the given time period 'attempts' => 3, // the duration, in seconds, for a regular failure to be stored for // resets on new failure 'duration' => 300, // the duration, in seconds, to disable login after exceeding `attemps` 'disableDuration' => 900, // the attribute used as the key in the database // and add errors to 'usernameAttribute' => 'username', // the attribute to check for errors 'passwordAttribute' => 'password', // the validation message to return to `usernameAttribute` 'message' => Yii::t('app', 'Login disabled'), ]; return $behaviors; }
统计信息
- 总下载量: 51.66k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 22
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: Unknown
- 更新时间: 2017-12-22