コード例 #1
0
ファイル: AuthController.php プロジェクト: artpro676/twitter
 /**
  * User auth method.
  * @return array
  */
 public function actionSignin()
 {
     $model = new LoginForm(new User());
     if ($model->load(\Yii::$app->getRequest()->getBodyParams(), '') && $model->login()) {
         return ['token' => \Yii::$app->user->identity->getAuthKey(), 'success' => true];
     } else {
         return ['message' => implode(' ', $model->getFirstErrors()), 'success' => false];
     }
 }