Example #1
0
 /**
  * Signs user up.
  *
  * @return mixed
  */
 public function actionSignup()
 {
     $model = new SignupForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->signup()) {
             if (Yii::$app->getUser()->login($user)) {
                 return $this->goHome();
             }
         }
     }
     return $this->render('signup', ['model' => $model]);
 }
 /**
  **显示注册页面(get);已登陆状态下注册一个新账号,会将激活新账号的链接发到新注册账号的认证邮箱(post).
  * @return string status for signing up
  */
 public function actionSignUp()
 {
     if (Yii::$app->request->isGet) {
         $csrf = Yii::$app->request->csrfToken;
         return $this->render('sign-up', ['csrf' => $csrf]);
     }
     $model = new SignupForm();
     if ($model->load(Yii::$app->request->post(), '') && $model->signup()) {
         AjaxResponse::success();
     }
     AjaxResponse::fail(null, $model->errors);
 }