Exemplo n.º 1
0
 /**
  * User sign-up method.
  * @return array
  */
 public function actionSignup()
 {
     $model = new SignupForm(new User());
     if ($model->load(\Yii::$app->getRequest()->getBodyParams(), '') && ($user = $model->signup())) {
         return ['auth_token' => $user->getAuthKey(), 'success' => true, 'user' => $user];
     } else {
         return ['message' => implode(' ', $model->getFirstErrors()), 'success' => false];
     }
 }