示例#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]);
 }
示例#2
0
 /**
  * Make sure that user can not take username|email that already exists.
  */
 public function testNotCorrectSignup()
 {
     $model = new SignupForm(['username' => 'user', 'email' => '*****@*****.**', 'password' => 'asDF@#12asdf', 'status' => 1]);
     expect('username and email are in use, user should not be created', $model->signup())->null();
 }