CC-4283: Password Reset: Please let user input username they want to reset

-done
This commit is contained in:
denise 2012-08-24 12:40:30 -04:00
parent ffa4c131ee
commit dc8e3da6db
4 changed files with 34 additions and 7 deletions

View File

@ -110,9 +110,16 @@ class LoginController extends Zend_Controller_Action
$request = $this->getRequest();
if ($request->isPost() && $form->isValid($request->getPost())) {
$user = CcSubjsQuery::create()
->filterByDbEmail($form->email->getValue())
->findOne();
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();
}
if (!empty($user)) {
$auth = new Application_Model_Auth();

View File

@ -20,6 +20,17 @@ class Application_Form_PasswordRestore extends Zend_Form
'ViewHelper'
)
));
$this->addElement('text', 'username', array(
'label' => 'Username',
'required' => false,
'filters' => array(
'stringTrim',
),
'decorators' => array(
'ViewHelper'
)
));
$this->addElement('submit', 'submit', array(
'label' => 'Restore password',

View File

@ -30,7 +30,8 @@ class Application_Model_Auth
$e_link_port = $_SERVER['SERVER_PORT'];
$e_link_path = $view->url(array('user_id' => $user->getDbId(), 'token' => $token), 'password-change');
$message = "Click this link: {$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}";
$message = "Hi {$user->getDbLogin()}, \n\nClick this link to reset your password: ";
$message .= "{$e_link_protocol}://{$e_link_base}:{$e_link_port}{$e_link_path}";
$success = Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail());

View File

@ -1,11 +1,20 @@
<form enctype="application/x-www-form-urlencoded" method="post" action="">
<dl class="zend_form">
<dt id="username-label">
<dt id="username-label">
<label for="username" class="required">
<?php echo $this->element->getElement('email')->getLabel() ?>
<?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()): ?>
@ -15,7 +24,6 @@
<?php endforeach; ?>
</ul>
<?php endif; ?>
<dt id="submit-label">&nbsp;</dt>
<dd id="submit-element">