SAAS-781 - password reset

This commit is contained in:
Duncan Sommerville 2015-07-22 13:48:47 -04:00
parent abdc94ccc3
commit 5c4803ddf2
8 changed files with 28 additions and 220 deletions

View file

@ -140,9 +140,6 @@ 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');
@ -150,16 +147,16 @@ class LoginController extends Zend_Controller_Action
$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();
$query = CcSubjsQuery::create();
if (empty($form->username->getValue())) {
$query->filterByDbEmail($form->email->getValue());
} else if (empty($form->email->getValue())) {
$query->filterByDbLogin($form->username->getValue());
} else {
$user = CcSubjsQuery::create()
->filterByDbEmail($form->email->getValue())
->filterByDbLogin($form->username->getValue())
->findOne();
$query->filterByDbEmail($form->email->getValue())
->filterByDbLogin($form->username->getValue());
}
$user = $query->findOne();
if (!empty($user)) {
$auth = new Application_Model_Auth();
@ -168,15 +165,14 @@ class LoginController extends Zend_Controller_Action
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.")));
$form->email->addError($this->view->translate(_("There was a problem sending the recovery email.")));
}
} else {
$form->email->addError($this->view->translate(_("Given email not found.")));
$form->email->addError($this->view->translate(_("We couldn't find the email you entered - you can also try <a href='https://account.sourcefabric.com/pwreset.php'>here</a>.")));
}
}
$this->view->form = $form;
// }
}
public function passwordRestoreAfterAction()