Example #1
0
 public function actionSignup()
 {
     $model = new SignupForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->signup()) {
             return $this->goHome();
         }
     }
     return $this->render('signup', ['model' => $model]);
 }
Example #2
0
 /**
  * Creates a new Post model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new SignupForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($user = $model->signup()) {
             return $this->redirect(['view', 'id' => $user->id]);
         }
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
 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('@frontend/views/site/signup', ['model' => $model]);
 }
Example #4
0
 /**
  * Creates a new User model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     if (!$this->is_access('user/create')) {
         Yii::$app->session->setFlash('error', $this->errorInfo);
         return $this->redirect($this->redirectUrl);
     }
     $model = new SignupForm();
     $model->scenario = 'create';
     if ($model->load(Yii::$app->request->post()) && $model->signup()) {
         Yii::$app->session->setFlash('success', '添加成功');
         return $this->redirect(['index']);
     } else {
         Yii::$app->view->params['meta_title'] = '添加管理员';
         $role_list = (new Role())->getRole();
         return $this->render('create', ['model' => $model, 'role_list' => $role_list]);
     }
 }