Esempio n. 1
0
 /**
  * Finds the User model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param  integer               $id
  * @return User                  the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     $user = $this->finder->findUserById($id);
     if ($user === null) {
         throw new NotFoundHttpException('The requested page does not exist');
     }
     return $user;
 }
 /**
  * Confirms user's account. If confirmation was successful logs the user and shows success message. Otherwise
  * shows error message.
  * @param  integer $id
  * @param  string  $code
  * @return string
  * @throws \yii\web\HttpException
  */
 public function actionConfirm($id, $code)
 {
     $user = $this->finder->findUserById($id);
     if ($user === null || $this->module->enableConfirmation == false) {
         throw new NotFoundHttpException();
     }
     $user->attemptConfirmation($code);
     return $this->render('/message', ['title' => \Yii::t('users', 'Account confirmation'), 'module' => $this->module]);
 }
 /**
  * Attempts changing user's password.
  * @param  integer $id
  * @param  string  $code
  * @return string
  * @throws \yii\web\HttpException
  */
 public function actionConfirm($id, $code)
 {
     $user = $this->finder->findUserById($id);
     if ($user === null || $this->module->emailChangeStrategy == Module::STRATEGY_INSECURE) {
         throw new NotFoundHttpException();
     }
     $user->attemptEmailChange($code);
     return $this->redirect('account');
 }