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()