SAAS-781 - Code review fixes

This commit is contained in:
Duncan Sommerville 2015-07-28 11:47:53 -04:00
commit 75aef986ea
3 changed files with 43 additions and 40 deletions

View File

@ -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('PRIVACY_POLICY_URL' , 'http://www.sourcefabric.org/en/about/policy/');
define('USER_MANUAL_URL' , 'http://sourcefabric.booktype.pro/airtime-pro-for-broadcasters'); define('USER_MANUAL_URL' , 'http://sourcefabric.booktype.pro/airtime-pro-for-broadcasters');
define('AIRTIME_TRANSIFEX_URL' , 'https://www.transifex.com/projects/p/airtime/'); 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_VERSION' , 'GNU AGPL v.3');
define('LICENSE_URL' , 'http://www.gnu.org/licenses/agpl-3.0-standalone.html'); define('LICENSE_URL' , 'http://www.gnu.org/licenses/agpl-3.0-standalone.html');

View File

@ -158,19 +158,21 @@ class LoginController extends Zend_Controller_Action
} }
$user = $query->findOne(); $user = $query->findOne();
if (!empty($user)) { if (!empty($user)) {
$auth = new Application_Model_Auth(); $auth = new Application_Model_Auth();
$success = $auth->sendPasswordRestoreLink($user, $this->view); $success = $auth->sendPasswordRestoreLink($user, $this->view);
if ($success) { if ($success) {
$this->_helper->redirector('password-restore-after', 'login'); $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(_("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='https://account.sourcefabric.com/pwreset.php'>here</a>."))); $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

@ -1,36 +1,36 @@
<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">
<dt id="username-label"> <dt id="username-label">
<label for="username" class="required"> <dt id="email-label">
<?php echo $this->element->getElement('username')->getLabel() ?> <label for="email" class="required">
</label> <?php echo $this->element->getElement('email')->getLabel() ?>
</dt> </label>
<dd id="username-element"> </dt>
<?php echo $this->element->getElement('username') ?> <dd id="email-element">
</dd> <?php echo $this->element->getElement('email') ?>
</dd>
<dt id="email-label"> <?php if ($this->element->getElement('email')->hasErrors()): ?>
<label for="email" class="required"> <ul class='errors'>
<?php echo $this->element->getElement('email')->getLabel() ?> <?php foreach ($this->element->getElement('email')->getMessages() as $error): ?>
</label> <li><?php echo $error; ?></li>
</dt> <?php endforeach; ?>
<dd id="email-element"> </ul>
<?php echo $this->element->getElement('email') ?> <?php endif; ?>
</dd>
<?php if($this->element->getElement('email')->hasErrors()): ?> <label for="username" class="required">
<ul class='errors'> <?php echo $this->element->getElement('username')->getLabel() ?>
<?php foreach($this->element->getElement('email')->getMessages() as $error): ?> </label>
<li><?php echo $error; ?></li> </dt>
<?php endforeach; ?> <dd id="username-element">
</ul> <?php echo $this->element->getElement('username') ?>
<?php endif; ?> </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') ?> <?php echo $this->element->getElement('cancel') ?>
</dd> </dd>
</dl> </dl>
</form> </form>