예제 #1
0
 /**
  * Valida la información de cambio de password.
  * Registra un codigo de cambio de password
  */
 public function actionForgetPassword()
 {
     //*
     $this->layout = "tplLogin";
     $message = '';
     $model = new ForgetPasswordForm();
     try {
         if (isset($_POST['ForgetPasswordForm'])) {
             $model->attributes = $_POST['ForgetPasswordForm'];
             if ($model->validate()) {
                 self::serverValidationForgetPasswordForm($model);
                 $email = strtolower(trim($model->email));
                 $changePasswordCode = UsersDao::getInstance()->updateChangePasswordCodeforValidUserActive($email);
                 $ulrChangePassword = Constants::URL_CHANGE_PASSWORD_CODE . $changePasswordCode;
                 $successMail = UtilsFunctions::sendMail(strtolower($email), Constants::SUBJECT_EMAIL_CHANGE_PASSWORD, Constants::HEAD_TEXT_CHANGE_PASSWORD, $ulrChangePassword, Constants::FOOTER_TEXT);
                 $message = $successMail ? Constants::SUCCESS_MAIL_DELIVERY : Constants::NOT_SUCCESS_MAIL_DELIVERY;
                 Yii::app()->user->setFlash('enter', $message);
                 $this->refresh();
             }
         }
     } catch (Exception $e) {
         Yii::app()->user->setFlash('enter', $e->getMessage());
         $this->refresh();
     }
     $this->render('forgetPassword', array('model' => $model, "errorSummary" => $message));
 }
예제 #2
0
 public function actionForget()
 {
     $this->layout = '//layouts/login-layout';
     $model = new ForgetPasswordForm();
     if (isset($_POST['ForgetPasswordForm'])) {
         $model->attributes = $_POST['ForgetPasswordForm'];
         if ($model->forgetPassword()) {
             Yii::app()->user->setFlash('message', 'Mật khẩu đã được gởi đến Email của bạn!');
             $this->refresh();
         } else {
             Yii::app()->user->setFlash('message_error', 'Email không đúng, vui lòng kiểm tra lại!');
         }
     }
     $this->render('forget', array('model' => $model));
 }
예제 #3
0
 public function actionForgetPassword()
 {
     $model = new ForgetPasswordForm();
     if (isset($_GET['done'])) {
         if (isset($_SESSION['forgetPasswordDone'])) {
             unset($_SESSION['forgetPasswordDone']);
             $this->render('forgetPasswordDone', array('model' => $model));
             Yii::app()->end();
         } else {
             $this->redirect(array('/site/forgetPassword'));
         }
     }
     if (!Yii::app()->user->isGuest) {
         $model->email = Yii::app()->user->name;
     }
     if (isset($_POST['ForgetPasswordForm'])) {
         $model->attributes = $_POST['ForgetPasswordForm'];
         if ($model->validate() && $model->sendMail()) {
             $_SESSION['forgetPasswordDone'] = true;
             $this->redirect(array('/site/forgetPassword', 'done' => 1));
         }
     }
     $this->pageTitle = array('Forget Password');
     $this->render('forgetPassword', array('model' => $model));
 }