/** * Creates a new model. * If creation is successful, the browser will be redirected to the 'view' page. */ public function actionCreate() { try { $model = new ProContactUs('create'); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['ProContactUs'])) { $model->attributes = $_POST['ProContactUs']; if ($model->save()) { $this->redirect(array('view', 'id' => $model->id)); } } $this->render('create', array('model' => $model, 'actions' => $this->listActionsCanAccess)); } catch (Exception $e) { Yii::log("Exception " . print_r($e, true), 'error'); throw new CHttpException("Exception " . print_r($e, true)); } }
$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'];