コード例 #1
0
 /**
  * Displays page where user can request new confirmation token. If resending was successful, displays message.
  *
  * @return string
  * @throws \yii\web\HttpException
  */
 public function actionResend()
 {
     if ($this->module->enableConfirmation == false) {
         throw new NotFoundHttpException();
     }
     /** @var ResendForm $model */
     $model = Yii::createObject(ResendForm::className());
     $event = $this->getFormEvent($model);
     $this->trigger(self::EVENT_BEFORE_RESEND, $event);
     $this->performAjaxValidation($model);
     if ($model->load(Yii::$app->request->post()) && $model->resend()) {
         $this->trigger(self::EVENT_AFTER_RESEND, $event);
         return $this->render('/loginEmail', ['title' => Yii::t('user', 'A new confirmation link has been sent'), 'module' => $this->module, "email" => $model->email, "emailFacilitator" => Util::getEmailLoginUrl($model->email)]);
     }
     return $this->render('resend', ['model' => $model]);
 }
コード例 #2
0
 /**
  * Shows page where user can request password recovery.
  *
  * @return string
  * @throws \yii\web\NotFoundHttpException
  */
 public function actionRequest()
 {
     if (!$this->module->enablePasswordRecovery) {
         throw new NotFoundHttpException();
     }
     /** @var RecoveryForm $model */
     $model = Yii::createObject(['class' => RecoveryForm::className(), 'scenario' => 'request']);
     $event = $this->getFormEvent($model);
     $this->performAjaxValidation($model);
     $this->trigger(self::EVENT_BEFORE_REQUEST, $event);
     if ($model->load(Yii::$app->request->post()) && $model->sendRecoveryMessage()) {
         $this->trigger(self::EVENT_AFTER_REQUEST, $event);
         return $this->render('/loginEmail', ['title' => Yii::t('user', 'Recovery message sent'), 'module' => $this->module, "email" => $model->email, "emailFacilitator" => Util::getEmailLoginUrl($model->email)]);
     }
     return $this->render('request', ['model' => $model]);
 }