Merge branch 'saas-dev' into saas-showbuilder

This commit is contained in:
Duncan Sommerville 2015-08-07 16:50:28 -04:00
commit 133db1c6a6
11 changed files with 118 additions and 78 deletions

View file

@ -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');

View file

@ -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.
@ -146,7 +144,8 @@ 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()) {
if ($form->isValid($request->getPost())) {
$query = CcSubjsQuery::create(); $query = CcSubjsQuery::create();
if (empty($form->username->getValue())) { if (empty($form->username->getValue())) {
$query->filterByDbEmail($form->email->getValue()); $query->filterByDbEmail($form->email->getValue());
@ -168,10 +167,11 @@ 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."))); $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(_("There was a problem sending the recovery email."))); $form->email->addError($this->view->translate(sprintf(_pro("That username or email address could not be found. If you are the station owner, you should <a href=\"%s\">reset your here</a>."), WHMCS_PASSWORD_RESET_URL)));
}
} else { //Form is not valid
$form->email->addError($this->view->translate(_("There was a problem with the username or email address you entered.")));
} }
} 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;

View file

@ -40,7 +40,7 @@ class Application_Form_PasswordChange extends Zend_Form
)); ));
$this->addElement('submit', 'submit', array( $this->addElement('submit', 'submit', array(
'label' => _('Get new password'), 'label' => _('Save'),
'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(

View file

@ -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);
*/
} }
} }

View file

@ -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,\nThe %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());
} }

View file

@ -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);
} }

View file

@ -1,6 +1,26 @@
<fieldset>
<legend>Station Owners</legend>
<p>
<?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)); ?>
</p>
</fieldset>
<fieldset>
<legend>DJs, Program Managers, and Others</legend>
<form enctype="application/x-www-form-urlencoded" method="post" action=""> <form enctype="application/x-www-form-urlencoded" method="post" action="">
<dl class="zend_form"> <dl class="zend_form">
<p>Please enter both your username and email address.</p>
<dt id="username-label"> <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"> <dt id="email-label">
<label for="email" class="required"> <label for="email" class="required">
<?php echo $this->element->getElement('email')->getLabel() ?> <?php echo $this->element->getElement('email')->getLabel() ?>
@ -17,20 +37,18 @@
</ul> </ul>
<?php endif; ?> <?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">&nbsp;</dt> <dt id="submit-label">&nbsp;</dt>
<dd id="submit-element"> <dd id="submit-element">
<?php echo $this->element->getElement('submit') ?> <?php echo $this->element->getElement('submit') ?>
</dd> </dd>
<dd id="cancel-element"> <dd id="cancel-element">
<?php echo $this->element->getElement('cancel') ?>
<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> </dd>
</dl> </dl>
</form> </form>
</fieldset>

View file

@ -1,9 +1,16 @@
<div class="login_box"> <div class="login_box">
<div class="logobox">&nbsp;</div> <div class="logobox">&nbsp;</div>
<h2><?php echo _("Email sent") ?></h2> <h2><?php echo _("Email Sent!") ?></h2>
<div id="login" class="login-content clearfix"> <div id="login" class="login-content clearfix">
<p class="light"><?php echo _("An email has been sent") ?></p> <p class="light"><?php echo _("A password reset link has been sent to your email address. Please check your email and follow the instructions inside to reset your password. If you don't see the email, please check your spam folder!") ?></p>
<p><a class="link" href="<?php echo $this->baseUrl('login'); ?>"><?php echo _("Back to login screen") ?></a></p> <br>
<dl class="zend-form">
<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>
</div> </div>
</div> </div>

View file

@ -1,12 +1,8 @@
<div class="login_box"> <div class="login_box">
<div class="logobox">&nbsp;</div> <div class="logobox">&nbsp;</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>

View file

@ -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;
@ -1089,7 +1102,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 {
@ -1214,14 +1227,18 @@ 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 ////////////////////---*/

View file

@ -1,3 +0,0 @@
function redirectToLogin(){
window.location = baseUrl+"Login"
}