PHP code example of iamtong / laravel-admin-login-check-safe
1. Go to this page and download the library: Download iamtong/laravel-admin-login-check-safe library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
iamtong / laravel-admin-login-check-safe example snippets
//登录验证码/用户锁定
'login-check-safe' => [
'enable' => true,
'login-error-num' => 5,//登录允许密码错误的次数
'login-error-limit-sec' => 600,//达到错误次数后锁定的时间(单位秒)
'password-expired' => 90*86400,//密码过期时间 90 天(单位秒)
'password-expired-except-name' => ['admin'],//排除账号不验证密码过期
'auto-out-sec' => 1800,//多久没活跃后,自动退出账号(单位秒),设置为0时,表示不开启此功能
'limit-one-login' => true,//是否开启 限制同时间一个账号仅限一人登录
'username-rules' => 'regex:/^[a-zA-Z0-9]+$/i|between:3,40',//用户名除了唯一性和必须填写之外的所有规则
'username-rules-msg' => [
'regex' => '用户名必须以大小写字母和数字组成',
],//对应的提示方法
'password-strong' => 1,// 【大写字母 小写字母 数字 特殊字符】 密码强度 必须使用其中的几种。
'password-length' => '6,40',//密码长度范围 10,40 10到40位;
'db' => [
//密码修改纪录表
'password_log_table' => 'admin_password_log',
'password_log_model' =>Encore\LoginCheckSafe\Models\PasswordLogModel::class,
//登录日志表
'login_log_table' => 'admin_login_log',
'login_log_model' =>Encore\LoginCheckSafe\Models\LoginLogModel::class,
]
],
'middleware' => ['web', 'admin',Encore\LoginCheckSafe\Http\Middleware\AdminCheck::class],
shell script
php artisan migrate