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

View File

@ -158,19 +158,21 @@ class LoginController extends Zend_Controller_Action
}
$user = $query->findOne();
if (!empty($user)) {
$auth = new Application_Model_Auth();
if (!empty($user)) {
$auth = new Application_Model_Auth();
$success = $auth->sendPasswordRestoreLink($user, $this->view);
if ($success) {
$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(_("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='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;
}

View File

@ -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">&nbsp;</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">&nbsp;</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>