Merge remote-tracking branch 'origin/saas-email' into saas-dev
This commit is contained in:
commit
1d39117b21
|
@ -17,6 +17,7 @@ define('TERMS_AND_CONDITIONS_URL' , 'http://www.sourcefabric.org/en/about/poli
|
|||
define('PRIVACY_POLICY_URL' , 'http://www.sourcefabric.org/en/about/policy/');
|
||||
define('USER_MANUAL_URL' , 'http://sourcefabric.booktype.pro/airtime-pro-for-broadcasters');
|
||||
define('AIRTIME_TRANSIFEX_URL' , 'https://www.transifex.com/projects/p/airtime/');
|
||||
define('WHMCS_PASSWORD_RESET_URL' , 'https://account.sourcefabric.com/pwreset.php');
|
||||
|
||||
define('LICENSE_VERSION' , 'GNU AGPL v.3');
|
||||
define('LICENSE_URL' , 'http://www.gnu.org/licenses/agpl-3.0-standalone.html');
|
||||
|
|
|
@ -140,26 +140,23 @@ 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');
|
||||
//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();
|
||||
}
|
||||
$request = $this->getRequest();
|
||||
if ($request->isPost() && $form->isValid($request->getPost())) {
|
||||
$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 {
|
||||
$query->filterByDbEmail($form->email->getValue())
|
||||
->filterByDbLogin($form->username->getValue());
|
||||
}
|
||||
$user = $query->findOne();
|
||||
|
||||
if (!empty($user)) {
|
||||
$auth = new Application_Model_Auth();
|
||||
|
@ -171,12 +168,13 @@ class LoginController extends Zend_Controller_Action
|
|||
$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.")));
|
||||
$form->email->addError($this->view->translate(_("There was a problem sending the recovery email.")));
|
||||
}
|
||||
} else {
|
||||
$form->email->addError($this->view->translate(_("We couldn't find the email you entered - you can also try <a href='".WHMCS_PASSWORD_RESET_URL."'>here</a>.")));
|
||||
}
|
||||
|
||||
$this->view->form = $form;
|
||||
}
|
||||
$this->view->form = $form;
|
||||
}
|
||||
|
||||
public function passwordRestoreAfterAction()
|
||||
|
|
|
@ -1,106 +0,0 @@
|
|||
<?php
|
||||
require_once 'customvalidators/ConditionalNotEmpty.php';
|
||||
|
||||
class Application_Form_EmailServerPreferences extends Zend_Form_SubForm
|
||||
{
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->setDecorators(array(
|
||||
array('ViewScript', array('viewScript' => 'form/preferences_email_server.phtml'))
|
||||
));
|
||||
|
||||
// Enable system emails
|
||||
$this->addElement('checkbox', 'enableSystemEmail', array(
|
||||
'label' => _('Enable System Emails (Password Reset)'),
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetEnableSystemEmail(),
|
||||
'decorators' => array(
|
||||
'ViewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
$this->addElement('text', 'systemEmail', array(
|
||||
'class' => 'input_text',
|
||||
'label' => _("Reset Password 'From' Email"),
|
||||
'value' => Application_Model_Preference::GetSystemEmail(),
|
||||
'readonly' => true,
|
||||
'decorators' => array('viewHelper')
|
||||
));
|
||||
|
||||
$this->addElement('checkbox', 'configureMailServer', array(
|
||||
'label' => _('Configure Mail Server'),
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetMailServerConfigured(),
|
||||
'decorators' => array (
|
||||
'viewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
$this->addElement('checkbox', 'msRequiresAuth', array(
|
||||
'label' => _('Requires Authentication'),
|
||||
'required' => false,
|
||||
'value' => Application_Model_Preference::GetMailServerRequiresAuth(),
|
||||
'decorators' => array(
|
||||
'viewHelper'
|
||||
)
|
||||
));
|
||||
|
||||
$this->addElement('text', 'mailServer', array(
|
||||
'class' => 'input_text',
|
||||
'label' => _('Mail Server'),
|
||||
'value' => Application_Model_Preference::GetMailServer(),
|
||||
'readonly' => true,
|
||||
'decorators' => array('viewHelper'),
|
||||
'allowEmpty' => false,
|
||||
'validators' => array(
|
||||
new ConditionalNotEmpty(array(
|
||||
'configureMailServer' => '1'
|
||||
))
|
||||
)
|
||||
));
|
||||
|
||||
$this->addElement('text', 'email', array(
|
||||
'class' => 'input_text',
|
||||
'label' => _('Email Address'),
|
||||
'value' => Application_Model_Preference::GetMailServerEmailAddress(),
|
||||
'readonly' => true,
|
||||
'decorators' => array('viewHelper'),
|
||||
'allowEmpty' => false,
|
||||
'validators' => array(
|
||||
new ConditionalNotEmpty(array(
|
||||
'configureMailServer' => '1',
|
||||
'msRequiresAuth' => '1'
|
||||
))
|
||||
)
|
||||
));
|
||||
|
||||
$this->addElement('password', 'ms_password', array(
|
||||
'class' => 'input_text',
|
||||
'label' => _('Password'),
|
||||
'value' => Application_Model_Preference::GetMailServerPassword(),
|
||||
'readonly' => true,
|
||||
'decorators' => array('viewHelper'),
|
||||
'allowEmpty' => false,
|
||||
'validators' => array(
|
||||
new ConditionalNotEmpty(array(
|
||||
'configureMailServer' => '1',
|
||||
'msRequiresAuth' => '1'
|
||||
))
|
||||
),
|
||||
'renderPassword' => true
|
||||
));
|
||||
|
||||
$port = new Zend_Form_Element_Text('port');
|
||||
$port->class = 'input_text';
|
||||
$port->setRequired(false)
|
||||
->setValue(Application_Model_Preference::GetMailServerPort())
|
||||
->setLabel(_('Port'))
|
||||
->setAttrib('readonly', true)
|
||||
->setDecorators(array('viewHelper'));
|
||||
|
||||
$this->addElement($port);
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -11,7 +11,7 @@ class Application_Form_PasswordRestore extends Zend_Form
|
|||
));
|
||||
|
||||
$this->addElement('text', 'email', array(
|
||||
'label' => _('E-mail'),
|
||||
'label' => _('Email'),
|
||||
'required' => true,
|
||||
'filters' => array(
|
||||
'stringTrim',
|
||||
|
@ -43,7 +43,7 @@ class Application_Form_PasswordRestore extends Zend_Form
|
|||
|
||||
$cancel = new Zend_Form_Element_Button("cancel");
|
||||
$cancel->class = 'ui-button ui-widget ui-state-default ui-button-text-only center';
|
||||
$cancel->setLabel(_("Cancel"))
|
||||
$cancel->setLabel(_("Return to login"))
|
||||
->setIgnore(True)
|
||||
->setAttrib('onclick', 'redirectToLogin();')
|
||||
->setDecorators(array('ViewHelper'));
|
||||
|
|
|
@ -34,9 +34,7 @@ class Application_Model_Auth
|
|||
$message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}";
|
||||
|
||||
$str = sprintf(_('%s Password Reset'), PRODUCT_NAME);
|
||||
$success = Application_Model_Email::send($str, $message, $user->getDbEmail());
|
||||
|
||||
return $success;
|
||||
return Application_Model_Email::send($str, $message, $user->getDbEmail());
|
||||
}
|
||||
|
||||
public function invalidateTokens($user, $action)
|
||||
|
|
|
@ -2,18 +2,20 @@
|
|||
|
||||
class Application_Model_Email
|
||||
{
|
||||
|
||||
/**
|
||||
* Send email
|
||||
*
|
||||
* @param string $subject
|
||||
* @param string $message
|
||||
* @param mixed $tos
|
||||
* @return void
|
||||
* @param mixed $to
|
||||
* @return boolean
|
||||
*/
|
||||
public static function send($subject, $message, $tos, $from = null)
|
||||
{
|
||||
public static function send($subject, $message, $to) {
|
||||
|
||||
return mail($tos, $subject, $message);
|
||||
$headers = 'From: Airtime <noreply@account.sourcefabric.com>';
|
||||
return mail($to, $subject, $message, $headers);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1161,87 +1161,6 @@ class Application_Model_Preference
|
|||
{
|
||||
return self::getValue("auto_switch");
|
||||
}
|
||||
|
||||
public static function SetEnableSystemEmail($upload)
|
||||
{
|
||||
self::setValue("enable_system_email", $upload);
|
||||
}
|
||||
|
||||
public static function GetEnableSystemEmail()
|
||||
{
|
||||
$v = self::getValue("enable_system_email");
|
||||
return ($v === "") ? 0 : $v;
|
||||
}
|
||||
|
||||
public static function SetSystemEmail($value)
|
||||
{
|
||||
self::setValue("system_email", $value, false);
|
||||
}
|
||||
|
||||
public static function GetSystemEmail()
|
||||
{
|
||||
return self::getValue("system_email");
|
||||
}
|
||||
|
||||
public static function SetMailServerConfigured($value)
|
||||
{
|
||||
self::setValue("mail_server_configured", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServerConfigured()
|
||||
{
|
||||
return self::getValue("mail_server_configured");
|
||||
}
|
||||
|
||||
public static function SetMailServer($value)
|
||||
{
|
||||
self::setValue("mail_server", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServer()
|
||||
{
|
||||
return self::getValue("mail_server");
|
||||
}
|
||||
|
||||
public static function SetMailServerEmailAddress($value)
|
||||
{
|
||||
self::setValue("mail_server_email_address", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServerEmailAddress()
|
||||
{
|
||||
return self::getValue("mail_server_email_address");
|
||||
}
|
||||
|
||||
public static function SetMailServerPassword($value)
|
||||
{
|
||||
self::setValue("mail_server_password", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServerPassword()
|
||||
{
|
||||
return self::getValue("mail_server_password");
|
||||
}
|
||||
|
||||
public static function SetMailServerPort($value)
|
||||
{
|
||||
self::setValue("mail_server_port", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServerPort()
|
||||
{
|
||||
return self::getValue("mail_server_port");
|
||||
}
|
||||
|
||||
public static function SetMailServerRequiresAuth($value)
|
||||
{
|
||||
self::setValue("mail_server_requires_auth", $value, false);
|
||||
}
|
||||
|
||||
public static function GetMailServerRequiresAuth()
|
||||
{
|
||||
return self::getValue("mail_server_requires_auth");
|
||||
}
|
||||
/* User specific preferences end */
|
||||
|
||||
public static function ShouldShowPopUp()
|
||||
|
|
|
@ -30,17 +30,15 @@
|
|||
|
||||
<?php echo $this->element->getElement('csrf') ?>
|
||||
|
||||
<?php if (Application_Model_Preference::GetEnableSystemEmail()): ?>
|
||||
<dt id="reset-label" class="hidden"> </dt>
|
||||
<dd id="reset-element" class="text-right">
|
||||
<a href="<?php echo $this->baseUrl('login/password-restore'); ?>" class="link reset"><?php echo _("Reset password") ?></a>
|
||||
</dd>
|
||||
<?php endif; ?>
|
||||
<?php echo $this->element->getElement('captcha') ?>
|
||||
<dt id="submit-label"> </dt>
|
||||
<dd id="submit-element">
|
||||
<?php echo $this->element->getElement('submit') ?>
|
||||
</dd>
|
||||
|
||||
|
||||
<dt id="reset-label" class="hidden"> </dt>
|
||||
<dd id="reset-element" class="text-right">
|
||||
<a href="<?php echo $this->baseUrl('login/password-restore'); ?>" class="link reset"><?php echo _("Forgot your password?") ?></a>
|
||||
</dd>
|
||||
</dl>
|
||||
</form>
|
||||
|
|
|
@ -1,36 +1,36 @@
|
|||
<form enctype="application/x-www-form-urlencoded" method="post" action="">
|
||||
<dl class="zend_form">
|
||||
<dt id="username-label">
|
||||
<label for="username" class="required">
|
||||
<?php echo $this->element->getElement('username')->getLabel() ?>
|
||||
</label>
|
||||
</dt>
|
||||
<dd id="username-element">
|
||||
<?php echo $this->element->getElement('username') ?>
|
||||
</dd>
|
||||
|
||||
<dt id="email-label">
|
||||
<label for="email" class="required">
|
||||
<?php echo $this->element->getElement('email')->getLabel() ?>
|
||||
</label>
|
||||
</dt>
|
||||
<dd id="email-element">
|
||||
<?php echo $this->element->getElement('email') ?>
|
||||
</dd>
|
||||
<?php if($this->element->getElement('email')->hasErrors()): ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach($this->element->getElement('email')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<dt id="submit-label"> </dt>
|
||||
<dd id="submit-element">
|
||||
<?php echo $this->element->getElement('submit') ?>
|
||||
</dd>
|
||||
<dd id="cancel-element">
|
||||
<?php echo $this->element->getElement('cancel') ?>
|
||||
</dd>
|
||||
<dl class="zend_form">
|
||||
<dt id="username-label">
|
||||
<dt id="email-label">
|
||||
<label for="email" class="required">
|
||||
<?php echo $this->element->getElement('email')->getLabel() ?>
|
||||
</label>
|
||||
</dt>
|
||||
<dd id="email-element">
|
||||
<?php echo $this->element->getElement('email') ?>
|
||||
</dd>
|
||||
<?php if ($this->element->getElement('email')->hasErrors()): ?>
|
||||
<ul class='errors'>
|
||||
<?php foreach ($this->element->getElement('email')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
|
||||
<label for="username" class="required">
|
||||
<?php echo $this->element->getElement('username')->getLabel() ?>
|
||||
</label>
|
||||
</dt>
|
||||
<dd id="username-element">
|
||||
<?php echo $this->element->getElement('username') ?>
|
||||
</dd>
|
||||
|
||||
<dt id="submit-label"> </dt>
|
||||
<dd id="submit-element">
|
||||
<?php echo $this->element->getElement('submit') ?>
|
||||
</dd>
|
||||
<dd id="cancel-element">
|
||||
<?php echo $this->element->getElement('cancel') ?>
|
||||
</dd>
|
||||
</dl>
|
||||
</form>
|
|
@ -1,10 +1,11 @@
|
|||
<div class="login_box">
|
||||
<div class="logobox"> </div>
|
||||
<h2><?php echo _("Reset password") ?></h2>
|
||||
|
||||
|
||||
<div id="login" class="login-content clearfix">
|
||||
<p class="light">
|
||||
<?php echo _("Please enter your account e-mail address. You will receive a link to create a new password via e-mail.")?>
|
||||
<?php echo _("Enter your account e-mail address or your username (or both, if you have multiple accounts
|
||||
using the same email address), and we'll send you a link to reset your password.")?>
|
||||
</p>
|
||||
<?php echo $this->form; ?>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue