fix login
This commit is contained in:
parent
c691273d02
commit
03b25a796d
@ -18,8 +18,14 @@ class UserController extends ApiController
|
||||
{
|
||||
public $modelClass = User::class;
|
||||
|
||||
// public function behaviors()
|
||||
// {
|
||||
public function behaviors()
|
||||
{
|
||||
$behaviors = parent::behaviors();
|
||||
if($this->action->id == "login"){
|
||||
unset($behaviors['authenticator']);
|
||||
}
|
||||
|
||||
return $behaviors;
|
||||
// return ArrayHelper::merge(parent::behaviors(), [
|
||||
// [
|
||||
// 'class' => ContentNegotiator::class,
|
||||
@ -42,7 +48,7 @@ class UserController extends ApiController
|
||||
// ]
|
||||
// ],
|
||||
// ]);
|
||||
// }
|
||||
}
|
||||
|
||||
public function actions()
|
||||
{
|
||||
@ -69,7 +75,7 @@ class UserController extends ApiController
|
||||
'access_token' => $model->login(),
|
||||
'access_token_expired_at' => $model->getUser()->getTokenExpiredAt(),
|
||||
'id' => $user->id,
|
||||
'status' => $user->userCard->status,
|
||||
'status' => $user->userCard->status ?? null,
|
||||
'card_id' => $user->userCard->id ?? null,
|
||||
];
|
||||
} else {
|
||||
|
@ -17,8 +17,11 @@ class User extends \common\models\User
|
||||
'email',
|
||||
'username',
|
||||
'userCard' => function () {
|
||||
$userCard = new UserCardSearch();
|
||||
return ProfileService::getProfileById($this->userCard->id);
|
||||
if(isset($this->userCard->id)){
|
||||
return ProfileService::getProfileById($this->userCard->id);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user