コード例 #1
0
ファイル: SiteController.php プロジェクト: jasonhai/onehome
                     $criteria->compare('t.role_id', ROLE_REGISTER_MEMBER);
                     $criteria->compare('t.application_id', FE);
                     $mUser = Users::model()->find($criteria);
                     if (!$mUser) {
                         $model->addError('email', 'Email does not exist.');
                     } elseif ($mUser->status == STATUS_ACTIVE) {
                         $password = substr(uniqid(rand(), 1), 1, 10);
                         $pass_en = md5($password);
                         $mUser->password_hash = $pass_en;
                         $mUser->temp_password = $password;
                         $mUser->update(array('password_hash', 'temp_password'));
                         SendEmail::forgotPassword($mUser, $password, ROLE_REGISTER_MEMBER);
                         Yii::app()->user->setFlash('success', "An email with your new password has been sent to " . $mUser->email . "\r\r                                                <br/>Please check your inbox.\r\r                                                <br/>If you do not receive the email, please add \"@properyinfo.sg\" to your mailbox safe list and check your Junk/Spam mailbox.");
                         if (isset($_POST['back'])) {
                             $this->redirect(Yii::app()->createAbsoluteUrl('site/login'));
                         }
                     } else {
                         $model->addError('email', 'Email does not exist.');
                     }
                 }
             }
             $this->render('forgot_password/forgot_password', array('model' => $model));
         }
     } catch (Exception $exc) {
         throw new CHttpException(404, 'Invalid request. Please do not repeat this request again.');
     }
 }
 public function actionError()
 {
     if ($error = Yii::app()->errorHandler->error) {
         if (Yii::app()->request->isAjaxRequest) {
             echo $error['message'];
コード例 #2
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     try {
         $model = ProContactUs::model()->findByPk($id);
         if ($model === null) {
             Yii::log("The requested page does not exist.");
             throw new CHttpException(404, 'The requested page does not exist.');
         }
         return $model;
     } catch (Exception $e) {
         Yii::log("Exception " . print_r($e, true), 'error');
         throw new CHttpException("Exception " . print_r($e, true));
     }
 }