Merge branch '2.1.x' into devel
Conflicts: airtime_mvc/application/models/Email.php
This commit is contained in:
commit
70bfe031ef
3 changed files with 27 additions and 8 deletions
|
@ -118,8 +118,12 @@ class LoginController extends Zend_Controller_Action
|
|||
if (!empty($user)) {
|
||||
$auth = new Application_Model_Auth();
|
||||
|
||||
$auth->sendPasswordRestoreLink($user, $this->view);
|
||||
$this->_helper->redirector('password-restore-after', 'login');
|
||||
$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."));
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -13,6 +13,8 @@ class Application_Model_Email {
|
|||
public static function send($subject, $message, $tos, $from = null)
|
||||
{
|
||||
$mailServerConfigured = Application_Model_Preference::GetMailServerConfigured() == true ? true : false;
|
||||
$success = true;
|
||||
|
||||
if ($mailServerConfigured) {
|
||||
$username = Application_Model_Preference::GetMailServerEmailAddress();
|
||||
$password = Application_Model_Preference::GetMailServerPassword();
|
||||
|
@ -46,10 +48,21 @@ class Application_Model_Email {
|
|||
|
||||
if ($mailServerConfigured) {
|
||||
$mail->setFrom(isset($from) ? $from : Application_Model_Preference::GetMailServerEmailAddress());
|
||||
$mail->send($transport);
|
||||
try {
|
||||
$mail->send($transport);
|
||||
} catch (Exception $e) {
|
||||
$success = false;
|
||||
}
|
||||
} else {
|
||||
$mail->setFrom(isset($from) ? $from : Application_Model_Preference::GetSystemEmail());
|
||||
$mail->send();
|
||||
try {
|
||||
$mail->send();
|
||||
} catch (Exception $e) {
|
||||
$success = false;
|
||||
}
|
||||
}
|
||||
|
||||
return $success;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue