CC-4283: Password Reset: Please let user input username they want to reset
-done
This commit is contained in:
parent
ffa4c131ee
commit
dc8e3da6db
|
@ -110,9 +110,16 @@ class LoginController extends Zend_Controller_Action
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
if ($request->isPost() && $form->isValid($request->getPost())) {
|
if ($request->isPost() && $form->isValid($request->getPost())) {
|
||||||
$user = CcSubjsQuery::create()
|
if (is_null($form->username->getValue()) || $form->username->getValue() == '') {
|
||||||
->filterByDbEmail($form->email->getValue())
|
$user = CcSubjsQuery::create()
|
||||||
->findOne();
|
->filterByDbEmail($form->email->getValue())
|
||||||
|
->findOne();
|
||||||
|
} else {
|
||||||
|
$user = CcSubjsQuery::create()
|
||||||
|
->filterByDbEmail($form->email->getValue())
|
||||||
|
->filterByDbLogin($form->username->getValue())
|
||||||
|
->findOne();
|
||||||
|
}
|
||||||
|
|
||||||
if (!empty($user)) {
|
if (!empty($user)) {
|
||||||
$auth = new Application_Model_Auth();
|
$auth = new Application_Model_Auth();
|
||||||
|
|
|
@ -21,6 +21,17 @@ class Application_Form_PasswordRestore extends Zend_Form
|
||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
$this->addElement('text', 'username', array(
|
||||||
|
'label' => 'Username',
|
||||||
|
'required' => false,
|
||||||
|
'filters' => array(
|
||||||
|
'stringTrim',
|
||||||
|
),
|
||||||
|
'decorators' => array(
|
||||||
|
'ViewHelper'
|
||||||
|
)
|
||||||
|
));
|
||||||
|
|
||||||
$this->addElement('submit', 'submit', array(
|
$this->addElement('submit', 'submit', array(
|
||||||
'label' => 'Restore password',
|
'label' => 'Restore password',
|
||||||
'ignore' => true,
|
'ignore' => true,
|
||||||
|
|
|
@ -30,7 +30,8 @@ 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 = "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());
|
$success = Application_Model_Email::send('Airtime Password Reset', $message, $user->getDbEmail());
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,20 @@
|
||||||
<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">
|
<label for="username" class="required">
|
||||||
<?php echo $this->element->getElement('email')->getLabel() ?>
|
<?php echo $this->element->getElement('username')->getLabel() ?>
|
||||||
</label>
|
</label>
|
||||||
</dt>
|
</dt>
|
||||||
<dd id="username-element">
|
<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') ?>
|
<?php echo $this->element->getElement('email') ?>
|
||||||
</dd>
|
</dd>
|
||||||
<?php if($this->element->getElement('email')->hasErrors()): ?>
|
<?php if($this->element->getElement('email')->hasErrors()): ?>
|
||||||
|
@ -16,7 +25,6 @@
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
|
||||||
<dt id="submit-label"> </dt>
|
<dt id="submit-label"> </dt>
|
||||||
<dd id="submit-element">
|
<dd id="submit-element">
|
||||||
<?php echo $this->element->getElement('submit') ?>
|
<?php echo $this->element->getElement('submit') ?>
|
||||||
|
|
Loading…
Reference in New Issue