Merge pull request #83 from apuc/api_update_login_method

api added id in response to login
This commit is contained in:
kavalar 2022-01-07 17:49:53 +03:00 committed by GitHub
commit 13568090b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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));