Merge branch '2.1.x' into devel

Conflicts:
	airtime_mvc/application/models/Email.php
This commit is contained in:
denise 2012-06-14 15:30:33 -04:00
commit 70bfe031ef
3 changed files with 27 additions and 8 deletions

View file

@ -118,8 +118,12 @@ class LoginController extends Zend_Controller_Action
if (!empty($user)) { if (!empty($user)) {
$auth = new Application_Model_Auth(); $auth = new Application_Model_Auth();
$auth->sendPasswordRestoreLink($user, $this->view); $success = $auth->sendPasswordRestoreLink($user, $this->view);
$this->_helper->redirector('password-restore-after', 'login'); 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 { else {
$form->email->addError($this->view->translate("Given email not found.")); $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}"; $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) public function invalidateTokens($user, $action)

View file

@ -13,6 +13,8 @@ class Application_Model_Email {
public static function send($subject, $message, $tos, $from = null) public static function send($subject, $message, $tos, $from = null)
{ {
$mailServerConfigured = Application_Model_Preference::GetMailServerConfigured() == true ? true : false; $mailServerConfigured = Application_Model_Preference::GetMailServerConfigured() == true ? true : false;
$success = true;
if ($mailServerConfigured) { if ($mailServerConfigured) {
$username = Application_Model_Preference::GetMailServerEmailAddress(); $username = Application_Model_Preference::GetMailServerEmailAddress();
$password = Application_Model_Preference::GetMailServerPassword(); $password = Application_Model_Preference::GetMailServerPassword();
@ -46,10 +48,21 @@ class Application_Model_Email {
if ($mailServerConfigured) { if ($mailServerConfigured) {
$mail->setFrom(isset($from) ? $from : Application_Model_Preference::GetMailServerEmailAddress()); $mail->setFrom(isset($from) ? $from : Application_Model_Preference::GetMailServerEmailAddress());
$mail->send($transport); try {
$mail->send($transport);
} catch (Exception $e) {
$success = false;
}
} else { } else {
$mail->setFrom(isset($from) ? $from : Application_Model_Preference::GetSystemEmail()); $mail->setFrom(isset($from) ? $from : Application_Model_Preference::GetSystemEmail());
$mail->send(); try {
$mail->send();
} catch (Exception $e) {
$success = false;
}
} }
return $success;
} }
} }