From 7d4851573f717a09d71554595743943138b3ebea Mon Sep 17 00:00:00 2001 From: denise Date: Fri, 8 Jun 2012 13:09:14 -0400 Subject: [PATCH] CC-3951: Password Reset: You can still reset password even after system email for Password Reset disabled -fixed --- .../controllers/LoginController.php | 51 ++++++++++--------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php index 043983ede..bb39d2978 100644 --- a/airtime_mvc/application/controllers/LoginController.php +++ b/airtime_mvc/application/controllers/LoginController.php @@ -14,7 +14,7 @@ class LoginController extends Zend_Controller_Action if (Zend_Auth::getInstance()->hasIdentity()) { - $this->_redirect('Showbuilder'); + $this->_redirect('Showbuilder'); } //uses separate layout without a navigation. @@ -99,30 +99,35 @@ class LoginController extends Zend_Controller_Action } public function passwordRestoreAction() - { - //uses separate layout without a navigation. - $this->_helper->layout->setLayout('login'); - - $form = new Application_Form_PasswordRestore(); - - $request = $this->getRequest(); - if ($request->isPost() && $form->isValid($request->getPost())) { - $user = CcSubjsQuery::create() - ->filterByDbEmail($form->email->getValue()) - ->findOne(); - - if (!empty($user)) { - $auth = new Application_Model_Auth(); - - $auth->sendPasswordRestoreLink($user, $this->view); - $this->_helper->redirector('password-restore-after', 'login'); - } - else { - $form->email->addError($this->view->translate("Given email not found.")); - } + { + if (!Application_Model_Preference::GetEnableSystemEmail()) { + $this->_redirect('login'); } + else { + //uses separate layout without a navigation. + $this->_helper->layout->setLayout('login'); + + $form = new Application_Form_PasswordRestore(); - $this->view->form = $form; + $request = $this->getRequest(); + if ($request->isPost() && $form->isValid($request->getPost())) { + $user = CcSubjsQuery::create() + ->filterByDbEmail($form->email->getValue()) + ->findOne(); + + if (!empty($user)) { + $auth = new Application_Model_Auth(); + + $auth->sendPasswordRestoreLink($user, $this->view); + $this->_helper->redirector('password-restore-after', 'login'); + } + else { + $form->email->addError($this->view->translate("Given email not found.")); + } + } + + $this->view->form = $form; + } } public function passwordRestoreAfterAction()