1.修改backend/config/main.php
'user' => [
'identityClass' => 'common\models\Adminuser',//认证类
'enableAutoLogin' => true,
'identityCookie' => ['name' => '_identity-backend', 'httpOnly' => true],
],
'session' => [//不影响前端登录
// this is the name of the session cookie used for login on the backend
'name' => 'advanced-backend',
'savePath'=>sys_get_temp_dir(),
],
'request'=>[
'cookieValidationKey'=>'sdfsfwef',
'csrfParam'=>'_adminCSRF',
],
2 新建AdminLoginForm.php 参考LoginForm.php
3 修改backend/controllers/SiteController.php里面LoginForm替换成AdminLoginForm
4 参考User.php修改Adminuser.php,去掉状态
public static function tableName()
{
return '{{%adminuser}}';
}