コード例 #1
0
 /**
  * Creates a new User model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new User();
     $model->scenario = 'create';
     $model->status = User::STATUS_ACTIVE;
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #2
0
 public function actionRequestPasswordResetToken()
 {
     $model = new User();
     $model->scenario = 'requestPasswordResetToken';
     if ($model->load($_POST) && $model->validate()) {
         if ($this->sendPasswordResetEmail($model->email)) {
             Yii::$app->getSession()->setFlash(Alert::TYPE_SUCCESS, Yii::t('gromver.platform', 'Check your email for further instructions.'));
             return $this->goHome();
         } else {
             Yii::$app->getSession()->setFlash(Alert::TYPE_DANGER, Yii::t('gromver.platform', 'There was an error sending email.'));
         }
     }
     return $this->render('requestPasswordResetToken', ['model' => $model]);
 }