Merge branch 'api_update_login_method' into add_document

This commit is contained in:
iIronside 2022-01-11 09:54:06 +03:00
commit 9c07e81fab

View File

@ -67,7 +67,9 @@ class UserController extends ActiveController
$model = new LoginForm(); $model = new LoginForm();
if ($model->load(Yii::$app->getRequest()->getBodyParams(), '') && $model->login()) { if ($model->load(Yii::$app->getRequest()->getBodyParams(), '') && $model->login()) {
return [ return [
'access_token' => $model->login(), 'access_token_expired_at' => $model->getUser()->getTokenExpiredAt() 'access_token' => $model->login(),
'access_token_expired_at' => $model->getUser()->getTokenExpiredAt(),
'id' => $model->getUser()->id,
]; ];
} else { } else {
throw new BadRequestHttpException(json_encode($model->errors)); throw new BadRequestHttpException(json_encode($model->errors));