From ce0cc946abdd5683baf5c2b28cfabefa01ef01e4 Mon Sep 17 00:00:00 2001 From: Duncan Sommerville Date: Thu, 23 Jul 2015 13:00:34 -0400 Subject: [PATCH] Disable password reset in saas-dev (moved to saas-email branch) --- .../controllers/LoginController.php | 64 +++++++++---------- .../views/scripts/form/login.phtml | 12 ++-- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/airtime_mvc/application/controllers/LoginController.php b/airtime_mvc/application/controllers/LoginController.php index e810d4246..920a258cc 100644 --- a/airtime_mvc/application/controllers/LoginController.php +++ b/airtime_mvc/application/controllers/LoginController.php @@ -140,43 +140,43 @@ class LoginController extends Zend_Controller_Action Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale)); -// if (!Application_Model_Preference::GetEnableSystemEmail()) { -// $this->_redirect('login'); -// } else { - //uses separate layout without a navigation. - $this->_helper->layout->setLayout('login'); + 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(); + $form = new Application_Form_PasswordRestore(); - $request = $this->getRequest(); - if ($request->isPost() && $form->isValid($request->getPost())) { - if (is_null($form->username->getValue()) || $form->username->getValue() == '') { - $user = CcSubjsQuery::create() - ->filterByDbEmail($form->email->getValue()) - ->findOne(); - } else { - $user = CcSubjsQuery::create() - ->filterByDbEmail($form->email->getValue()) - ->filterByDbLogin($form->username->getValue()) - ->findOne(); - } - - if (!empty($user)) { - $auth = new Application_Model_Auth(); - - $success = $auth->sendPasswordRestoreLink($user, $this->view); - if ($success) { - $this->_helper->redirector('password-restore-after', 'login'); + $request = $this->getRequest(); + if ($request->isPost() && $form->isValid($request->getPost())) { + if (is_null($form->username->getValue()) || $form->username->getValue() == '') { + $user = CcSubjsQuery::create() + ->filterByDbEmail($form->email->getValue()) + ->findOne(); } else { - $form->email->addError($this->view->translate(_("Email could not be sent. Check your mail server settings and ensure it has been configured properly."))); + $user = CcSubjsQuery::create() + ->filterByDbEmail($form->email->getValue()) + ->filterByDbLogin($form->username->getValue()) + ->findOne(); } - } else { - $form->email->addError($this->view->translate(_("Given email not found."))); - } - } - $this->view->form = $form; -// } + if (!empty($user)) { + $auth = new Application_Model_Auth(); + + $success = $auth->sendPasswordRestoreLink($user, $this->view); + if ($success) { + $this->_helper->redirector('password-restore-after', 'login'); + } else { + $form->email->addError($this->view->translate(_("Email could not be sent. Check your mail server settings and ensure it has been configured properly."))); + } + } else { + $form->email->addError($this->view->translate(_("Given email not found."))); + } + } + + $this->view->form = $form; + } } public function passwordRestoreAfterAction() diff --git a/airtime_mvc/application/views/scripts/form/login.phtml b/airtime_mvc/application/views/scripts/form/login.phtml index 09893410d..c286c45be 100644 --- a/airtime_mvc/application/views/scripts/form/login.phtml +++ b/airtime_mvc/application/views/scripts/form/login.phtml @@ -30,12 +30,12 @@ element->getElement('csrf') ?> - - -
- -
- + + +
+ +
+ element->getElement('captcha') ?>