Clean up and bugfixes for password reset (SAAS-1009)
This commit is contained in:
parent
ea86675d07
commit
ea2a6b3f68
|
@ -9,6 +9,7 @@ define('COMPANY_NAME' , 'Sourcefabric');
|
||||||
define('COMPANY_SUFFIX' , 'z.ú.');
|
define('COMPANY_SUFFIX' , 'z.ú.');
|
||||||
define('COMPANY_SITE' , 'Sourcefabric.org');
|
define('COMPANY_SITE' , 'Sourcefabric.org');
|
||||||
define('COMPANY_SITE_URL' , 'http://sourcefabric.org/');
|
define('COMPANY_SITE_URL' , 'http://sourcefabric.org/');
|
||||||
|
define('SUPPORT_EMAIL_ADDRESS', "help@sourcefabric.org");
|
||||||
|
|
||||||
define('HELP_URL' , 'http://help.sourcefabric.org/');
|
define('HELP_URL' , 'http://help.sourcefabric.org/');
|
||||||
define('FAQ_URL' , 'https://sourcefabricberlin.zendesk.com/hc/en-us/sections/200994309-Airtime-FAQ');
|
define('FAQ_URL' , 'https://sourcefabricberlin.zendesk.com/hc/en-us/sections/200994309-Airtime-FAQ');
|
||||||
|
|
|
@ -38,11 +38,9 @@ class LoginController extends Zend_Controller_Action
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/login/login.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
|
||||||
|
|
||||||
$form = new Application_Form_Login();
|
$form = new Application_Form_Login();
|
||||||
|
|
||||||
$message = _("Please enter your user name and password");
|
$message = _("Please enter your username and password.");
|
||||||
|
|
||||||
if ($request->isPost()) {
|
if ($request->isPost()) {
|
||||||
// if the post contains recaptcha field, which means form had recaptcha field.
|
// if the post contains recaptcha field, which means form had recaptcha field.
|
||||||
|
@ -132,12 +130,12 @@ class LoginController extends Zend_Controller_Action
|
||||||
$CC_CONFIG = Config::getConfig();
|
$CC_CONFIG = Config::getConfig();
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
|
||||||
$this->view->headScript()->appendFile($baseUrl.'js/airtime/login/password-restore.js?'.$CC_CONFIG['airtime_version'],'text/javascript');
|
$this->view->headScript()->appendFile($baseUrl . 'js/airtime/login/password-restore.js?' . $CC_CONFIG['airtime_version'], 'text/javascript');
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$stationLocale = Application_Model_Preference::GetDefaultLocale();
|
$stationLocale = Application_Model_Preference::GetDefaultLocale();
|
||||||
|
|
||||||
Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale));
|
Application_Model_Locale::configureLocalization($request->getcookie('airtime_locale', $stationLocale));
|
||||||
|
|
||||||
//uses separate layout without a navigation.
|
//uses separate layout without a navigation.
|
||||||
|
@ -146,17 +144,18 @@ class LoginController extends Zend_Controller_Action
|
||||||
$form = new Application_Form_PasswordRestore();
|
$form = new Application_Form_PasswordRestore();
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
if ($request->isPost() && $form->isValid($request->getPost())) {
|
if ($request->isPost()) {
|
||||||
$query = CcSubjsQuery::create();
|
if ($form->isValid($request->getPost())) {
|
||||||
if (empty($form->username->getValue())) {
|
$query = CcSubjsQuery::create();
|
||||||
$query->filterByDbEmail($form->email->getValue());
|
if (empty($form->username->getValue())) {
|
||||||
} else if (empty($form->email->getValue())) {
|
$query->filterByDbEmail($form->email->getValue());
|
||||||
$query->filterByDbLogin($form->username->getValue());
|
} else if (empty($form->email->getValue())) {
|
||||||
} else {
|
$query->filterByDbLogin($form->username->getValue());
|
||||||
$query->filterByDbEmail($form->email->getValue())
|
} else {
|
||||||
->filterByDbLogin($form->username->getValue());
|
$query->filterByDbEmail($form->email->getValue())
|
||||||
}
|
->filterByDbLogin($form->username->getValue());
|
||||||
$user = $query->findOne();
|
}
|
||||||
|
$user = $query->findOne();
|
||||||
|
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
$auth = new Application_Model_Auth();
|
$auth = new Application_Model_Auth();
|
||||||
|
@ -171,8 +170,9 @@ class LoginController extends Zend_Controller_Action
|
||||||
$form->email->addError($this->view->translate(_("There was a problem sending the recovery email.")));
|
$form->email->addError($this->view->translate(_("There was a problem sending the recovery email.")));
|
||||||
}
|
}
|
||||||
} else {
|
} 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>.")));
|
$form->email->addError($this->view->translate(sprintf(_pro("We couldn't find the email you entered - you can also try <a href=\"%s\">here</a>."), WHMCS_PASSWORD_RESET_URL)));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ class Application_Form_PasswordRestore extends Zend_Form
|
||||||
));
|
));
|
||||||
|
|
||||||
$this->addElement('submit', 'submit', array(
|
$this->addElement('submit', 'submit', array(
|
||||||
'label' => _('Restore password'),
|
'label' => _('Reset password'),
|
||||||
'ignore' => true,
|
'ignore' => true,
|
||||||
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center',
|
'class' => 'ui-button ui-widget ui-state-default ui-button-text-only center',
|
||||||
'decorators' => array(
|
'decorators' => array(
|
||||||
|
@ -41,12 +41,14 @@ class Application_Form_PasswordRestore extends Zend_Form
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
/*
|
||||||
$cancel = new Zend_Form_Element_Button("cancel");
|
$cancel = new Zend_Form_Element_Button("cancel");
|
||||||
$cancel->class = 'ui-button ui-widget ui-state-default ui-button-text-only center';
|
$cancel->class = 'ui-button ui-widget ui-state-default ui-button-text-only center';
|
||||||
$cancel->setLabel(_("Return to login"))
|
$cancel->setLabel(_("Back"))
|
||||||
->setIgnore(True)
|
->setIgnore(True)
|
||||||
->setAttrib('onclick', 'redirectToLogin();')
|
->setAttrib('onclick', 'window.location = ' . Zend_Controller_Front::getInstance()->getBaseUrl('login'))
|
||||||
->setDecorators(array('ViewHelper'));
|
->setDecorators(array('ViewHelper'));
|
||||||
$this->addElement($cancel);
|
$this->addElement($cancel);
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,10 +30,12 @@ class Application_Model_Auth
|
||||||
$e_link_port = $_SERVER['SERVER_PORT'];
|
$e_link_port = $_SERVER['SERVER_PORT'];
|
||||||
$e_link_path = $view->url(array('user_id' => $user->getDbId(), 'token' => $token), 'password-change');
|
$e_link_path = $view->url(array('user_id' => $user->getDbId(), 'token' => $token), 'password-change');
|
||||||
|
|
||||||
$message = sprintf(_("Hi %s, \n\nClick this link to reset your password: "), $user->getDbLogin());
|
$message = sprintf(_("Hi %s, \n\nPlease click this link to reset your password: "), $user->getDbLogin());
|
||||||
$message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}";
|
$message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}";
|
||||||
|
$message .= sprintf(_pro("\n\nIf you have any problems, please contact our support team: %s"), SUPPORT_EMAIL_ADDRESS);
|
||||||
|
$message .= sprintf(_pro("\n\nThank you, The %s Team"), SAAS_PRODUCT_BRANDING_NAME);
|
||||||
|
|
||||||
$str = sprintf(_('%s Password Reset'), PRODUCT_NAME);
|
$str = sprintf(_('%s Password Reset'), SAAS_PRODUCT_BRANDING_NAME);
|
||||||
return Application_Model_Email::send($str, $message, $user->getDbEmail());
|
return Application_Model_Email::send($str, $message, $user->getDbEmail());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Application_Model_Email
|
||||||
*/
|
*/
|
||||||
public static function send($subject, $message, $to) {
|
public static function send($subject, $message, $to) {
|
||||||
|
|
||||||
$headers = 'From: Airtime <noreply@account.sourcefabric.com>';
|
$headers = sprintf('From: %s <noreply@account.sourcefabric.com>', SAAS_PRODUCT_BRANDING_NAME);
|
||||||
return mail($to, $subject, $message, $headers);
|
return mail($to, $subject, $message, $headers);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,54 @@
|
||||||
<form enctype="application/x-www-form-urlencoded" method="post" action="">
|
<fieldset>
|
||||||
<dl class="zend_form">
|
<legend>Station Owners</legend>
|
||||||
<dt id="username-label">
|
<p>
|
||||||
<dt id="email-label">
|
<?php echo(sprintf(_pro("If you are the primary owner of this station, <a href=\"%s\">please reset your password here</a>."), WHMCS_PASSWORD_RESET_URL)); ?>
|
||||||
<label for="email" class="required">
|
</p>
|
||||||
<?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">
|
</fieldset>
|
||||||
<?php echo $this->element->getElement('username')->getLabel() ?>
|
<fieldset>
|
||||||
</label>
|
<legend>DJs, Program Managers, and Others</legend>
|
||||||
</dt>
|
<form enctype="application/x-www-form-urlencoded" method="post" action="">
|
||||||
<dd id="username-element">
|
<dl class="zend_form">
|
||||||
<?php echo $this->element->getElement('username') ?>
|
|
||||||
</dd>
|
<p>Please enter both your username and email address.</p>
|
||||||
|
<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>
|
||||||
|
|
||||||
|
<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">
|
||||||
|
|
||||||
|
<a href="<?php echo($this->baseUrl('login')); ?>">
|
||||||
|
<button name="cancel" type="button" class="ui-button ui-widget ui-state-default ui-button-text-only center"><?php echo(_("Back")); ?></button>
|
||||||
|
</a>
|
||||||
|
</dd>
|
||||||
|
</dl>
|
||||||
|
</form>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
<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,12 +1,8 @@
|
||||||
<div class="login_box">
|
<div class="login_box">
|
||||||
<div class="logobox"> </div>
|
<div class="logobox"> </div>
|
||||||
<h2><?php echo _("Reset password") ?></h2>
|
<h2><?php echo _("Password Reset") ?></h2>
|
||||||
|
|
||||||
<div id="login" class="login-content clearfix">
|
<div id="login" class="login-content clearfix">
|
||||||
<p class="light">
|
|
||||||
<?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; ?>
|
<?php echo $this->form; ?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -21,6 +21,19 @@ html, body {
|
||||||
text-align:center;
|
text-align:center;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#login-page fieldset
|
||||||
|
{
|
||||||
|
padding: 10px;
|
||||||
|
border: 1px solid #555;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
#login-page legend {
|
||||||
|
font-weight: bold;
|
||||||
|
color: #919191;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
h2 {
|
h2 {
|
||||||
color: #000000;
|
color: #000000;
|
||||||
font-size: 2.1em;
|
font-size: 2.1em;
|
||||||
|
@ -1070,7 +1083,7 @@ input[type="checkbox"] {
|
||||||
margin:0;
|
margin:0;
|
||||||
padding:8px 0 16px 0;
|
padding:8px 0 16px 0;
|
||||||
font-size:12px;
|
font-size:12px;
|
||||||
color:#717171;
|
color: #919191;
|
||||||
text-align:left;
|
text-align:left;
|
||||||
}
|
}
|
||||||
.logobox {
|
.logobox {
|
||||||
|
@ -1195,13 +1208,17 @@ input[type="checkbox"] {
|
||||||
.login-content .text-right, .text-right {
|
.login-content .text-right, .text-right {
|
||||||
text-align:right;
|
text-align:right;
|
||||||
}
|
}
|
||||||
.login-content .link {
|
.login-content a {
|
||||||
color:#FF5D1A;
|
color:#FF5D1A;
|
||||||
text-decoration:none;
|
text-decoration:none;
|
||||||
}
|
}
|
||||||
.login-content .link:hover {
|
.login-content a:hover {
|
||||||
text-decoration:underline;
|
text-decoration:underline;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.login-content .errors a {
|
||||||
|
color: #ff1c13;
|
||||||
|
}
|
||||||
|
|
||||||
/*---//////////////////// END LOGIN ////////////////////---*/
|
/*---//////////////////// END LOGIN ////////////////////---*/
|
||||||
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
function redirectToLogin(){
|
|
||||||
window.location = baseUrl+"Login"
|
|
||||||
}
|
|
Loading…
Reference in New Issue