CC-3970: Password Reset: No UI error msg for no mail server founded

-done
This commit is contained in:
denise 2012-06-13 16:04:57 -04:00
parent 4077858c8e
commit f433fd89fe
3 changed files with 19 additions and 6 deletions

View file

@ -118,8 +118,12 @@ class LoginController extends Zend_Controller_Action
if (!empty($user)) {
$auth = new Application_Model_Auth();
$auth->sendPasswordRestoreLink($user, $this->view);
$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."));

View file

@ -31,7 +31,9 @@ class Application_Model_Auth {
$message = "Click this link: {$e_link_protocol}://{$e_link_base}{$e_link_path}";
Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail());
$success = Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail());
return $success;
}
public function invalidateTokens($user, $action)

View file

@ -12,6 +12,7 @@ class Application_Model_Email {
*/
public static function send($subject, $message, $tos, $from = null)
{
$success = true;
$mail = new Zend_Mail('utf-8');
$mail->setSubject($subject);
$mail->setBodyText($message);
@ -21,6 +22,12 @@ class Application_Model_Email {
$mail->addTo($to);
}
try {
$mail->send();
} catch (Exception $e) {
$success = false;
}
return $success;
}
}