worstinme / yii2-user
Yii2用户认证模块
1.0.2
2017-02-07 08:51 UTC
Requires
This package is not auto-updated.
Last update: 2024-09-14 18:20:29 UTC
README
开发中。使用风险自担
使用Uikit框架设计的用户认证/数据库-RBAC/认证客户端模块。
安装
安装此扩展的首选方式是通过composer。
运行以下命令:
php composer.phar require --prefer-dist worstinme/yii2-user
或者
"worstinme/yii2-user": "^1.0.0"
将以下内容添加到您的composer.json
文件的require部分。
所需配置
'modules' => [ 'user' => [ 'class' => 'worstinme\user\Module', ], 'useradmin' => [ 'class' => 'worstinme\user\backend\Module', ], .... ], 'components' => [ 'user' => [ 'class'=>'worstinme\user\User', 'identityClass' => 'worstinme\user\models\User', 'enableAutoLogin' => true, 'loginUrl'=>['/user/default/login'], ], 'authClientCollection' => [ 'class' => 'yii\authclient\Collection', 'clients' => [ 'google' => [ 'class' => 'yii\authclient\clients\GoogleOpenId' ], 'facebook' => [ 'class' => 'yii\authclient\clients\Facebook', 'clientId' => 'facebook_client_id', 'clientSecret' => 'facebook_client_secret', ], // etc. ], ] // ... ]
RBAC配置
到web.php & console.php组件部分
'authManager' => [ 'class' => 'yii\rbac\DbManager', ], ]
& 迁移文件
$ yii migrate --migrationPath=@yii/rbac/migrations/
然后,使用迁移创建用户表 & 默认用户管理员:administrator(具有管理员角色,别忘了更改默认密码)。
$ yii migrate --migrationPath=@worstinme/user/migrations/