CC-4472: User password verify or clear text display.
-done with password verify
This commit is contained in:
parent
86f57cb953
commit
a129b0b081
|
@ -36,6 +36,16 @@ class Application_Form_AddUser extends Zend_Form
|
|||
$password->addValidator($notEmptyValidator);
|
||||
$this->addElement($password);
|
||||
|
||||
$passwordIdenticalValidator = Application_Form_Helper_ValidationTypes::overridePasswordIdenticalValidator('password');
|
||||
$passwordVerify = new Zend_Form_Element_Password('passwordVerify');
|
||||
$passwordVerify->setLabel(_('Verify Password:'));
|
||||
$passwordVerify->setAttrib('class', 'input_text');
|
||||
$passwordVerify->setRequired(true);
|
||||
$passwordVerify->addFilter('StringTrim');
|
||||
$passwordVerify->addValidator($notEmptyValidator);
|
||||
$passwordVerify->addValidator($passwordIdenticalValidator);
|
||||
$this->addElement($passwordVerify);
|
||||
|
||||
$firstName = new Zend_Form_Element_Text('first_name');
|
||||
$firstName->setLabel(_('Firstname:'));
|
||||
$firstName->setAttrib('class', 'input_text');
|
||||
|
|
|
@ -46,6 +46,17 @@ class Application_Form_EditUser extends Zend_Form
|
|||
$password->setDecorators(array('viewHelper'));
|
||||
$this->addElement($password);
|
||||
|
||||
$passwordIdenticalValidator = Application_Form_Helper_ValidationTypes::overridePasswordIdenticalValidator('cu_password');
|
||||
$passwordVerify = new Zend_Form_Element_Password('cu_passwordVerify');
|
||||
$passwordVerify->setLabel(_('Verify Password:'));
|
||||
$passwordVerify->setAttrib('class', 'input_text');
|
||||
$passwordVerify->setRequired(true);
|
||||
$passwordVerify->addFilter('StringTrim');
|
||||
$passwordVerify->addValidator($notEmptyValidator);
|
||||
$passwordVerify->addValidator($passwordIdenticalValidator);
|
||||
$passwordVerify->setDecorators(array('viewHelper'));
|
||||
$this->addElement($passwordVerify);
|
||||
|
||||
$firstName = new Zend_Form_Element_Text('cu_first_name');
|
||||
$firstName->setLabel(_('Firstname:'));
|
||||
$firstName->setValue($userData["first_name"]);
|
||||
|
|
|
@ -80,4 +80,17 @@ Class Application_Form_Helper_ValidationTypes {
|
|||
return $validator;
|
||||
}
|
||||
|
||||
public static function overridePasswordIdenticalValidator($p_matchAgainst)
|
||||
{
|
||||
$validator = new Zend_Validate_Identical();
|
||||
$validator->setToken($p_matchAgainst);
|
||||
|
||||
$validator->setMessage(
|
||||
_("Passwords do not match"),
|
||||
Zend_Validate_Identical::NOT_SAME
|
||||
);
|
||||
|
||||
return $validator;
|
||||
}
|
||||
|
||||
}
|
|
@ -10,7 +10,7 @@
|
|||
<dd id="cu-username-element">
|
||||
<?php echo $this->element->getElement('cu_login') ?>
|
||||
<?php if($this->element->getElement('cu_login')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<ul class='errors edit-user-errors'>
|
||||
<?php foreach($this->element->getElement('cu_login')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
|
@ -24,13 +24,27 @@
|
|||
<dd id="cu-password-element">
|
||||
<?php echo $this->element->getElement('cu_password') ?>
|
||||
<?php if($this->element->getElement('cu_password')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<ul class='errors edit-user-errors'>
|
||||
<?php foreach($this->element->getElement('cu_password')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt id="cu-passwordVerify-label">
|
||||
<label><?php echo $this->element->getElement('cu_passwordVerify')->getLabel() ?>
|
||||
</label>
|
||||
</dt>
|
||||
<dd id="cu-passwordVerify-element">
|
||||
<?php echo $this->element->getElement('cu_passwordVerify') ?>
|
||||
<?php if($this->element->getElement('cu_passwordVerify')->hasErrors()) : ?>
|
||||
<ul class='errors edit-user-errors'>
|
||||
<?php foreach($this->element->getElement('cu_passwordVerify')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</dd>
|
||||
<dt id="cu-firstname-label">
|
||||
<label><?php echo $this->element->getElement('cu_first_name')->getLabel() ?>
|
||||
</label>
|
||||
|
@ -38,7 +52,7 @@
|
|||
<dd id="cu-firstname-element">
|
||||
<?php echo $this->element->getElement('cu_first_name') ?>
|
||||
<?php if($this->element->getElement('cu_first_name')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<ul class='errors edit-user-errors'>
|
||||
<?php foreach($this->element->getElement('cu_first_name')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
|
@ -52,7 +66,7 @@
|
|||
<dd id="cu-lastname-element">
|
||||
<?php echo $this->element->getElement('cu_last_name') ?>
|
||||
<?php if($this->element->getElement('cu_last_name')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<ul class='errors edit-user-errors'>
|
||||
<?php foreach($this->element->getElement('cu_last_name')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
|
@ -66,7 +80,7 @@
|
|||
<dd id="cu-email-element">
|
||||
<?php echo $this->element->getElement('cu_email') ?>
|
||||
<?php if($this->element->getElement('cu_email')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<ul class='errors edit-user-errors'>
|
||||
<?php foreach($this->element->getElement('cu_email')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
|
@ -80,7 +94,7 @@
|
|||
<dd id="cu-cell_phone-element">
|
||||
<?php echo $this->element->getElement('cu_cell_phone') ?>
|
||||
<?php if($this->element->getElement('cu_cell_phone')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<ul class='errors edit-user-errors'>
|
||||
<?php foreach($this->element->getElement('cu_cell_phone')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
|
@ -94,7 +108,7 @@
|
|||
<dd id="cu-skype-element">
|
||||
<?php echo $this->element->getElement('cu_skype') ?>
|
||||
<?php if($this->element->getElement('cu_skype')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<ul class='errors edit-user-errors'>
|
||||
<?php foreach($this->element->getElement('cu_skype')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
|
@ -108,7 +122,7 @@
|
|||
<dd id="cu-jabber-element">
|
||||
<?php echo $this->element->getElement('cu_jabber') ?>
|
||||
<?php if($this->element->getElement('cu_jabber')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<ul class='errors edit-user-errors'>
|
||||
<?php foreach($this->element->getElement('cu_jabber')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
|
@ -122,7 +136,7 @@
|
|||
<dd id="cu-locale-element">
|
||||
<?php echo $this->element->getElement('cu_locale') ?>
|
||||
<?php if($this->element->getElement('cu_locale')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<ul class='errors edit-user-errors'>
|
||||
<?php foreach($this->element->getElement('cu_locale')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
|
@ -136,7 +150,7 @@
|
|||
<dd id="cu-timezone-element">
|
||||
<?php echo $this->element->getElement('cu_timezone') ?>
|
||||
<?php if($this->element->getElement('cu_timezone')->hasErrors()) : ?>
|
||||
<ul class='errors'>
|
||||
<ul class='errors edit-user-errors'>
|
||||
<?php foreach($this->element->getElement('cu_timezone')->getMessages() as $error): ?>
|
||||
<li><?php echo $error; ?></li>
|
||||
<?php endforeach; ?>
|
||||
|
|
|
@ -2989,6 +2989,9 @@ dd .stream-status {
|
|||
width: 200px;
|
||||
}
|
||||
|
||||
.edit-user-errors {
|
||||
margin-left: 33% !important;
|
||||
width: 208px;
|
||||
|
||||
.jp-container a#popup-link {
|
||||
width: 104px;
|
||||
|
|
|
@ -448,12 +448,15 @@ function init() {
|
|||
*/
|
||||
function setCurrentUserPseudoPassword() {
|
||||
$('#cu_password').val("xxxxxx");
|
||||
$('#cu_passwordVerify').val("xxxxxx");
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
if ($('#master-panel').length > 0)
|
||||
init();
|
||||
setCurrentUserPseudoPassword();
|
||||
if ($('.errors').length === 0) {
|
||||
setCurrentUserPseudoPassword();
|
||||
}
|
||||
|
||||
$('#current-user').live('click', function() {
|
||||
$.ajax({
|
||||
|
|
|
@ -17,9 +17,11 @@ function populateForm(entries){
|
|||
if (entries.id.length != 0){
|
||||
$('#login').attr('readonly', 'readonly');
|
||||
$('#password').val("xxxxxx");
|
||||
$('#passwordVerify').val("xxxxxx");
|
||||
} else {
|
||||
$('#login').removeAttr('readonly');
|
||||
$('#password').val("");
|
||||
$('#passwordVerify').val("");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -92,6 +94,11 @@ function populateUserTable() {
|
|||
});
|
||||
}
|
||||
|
||||
function sizeFormElements() {
|
||||
$("dt[id$='label']").addClass('user-form-label');
|
||||
$("dd[id$='element']").addClass('user-form-element');
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
populateUserTable();
|
||||
|
||||
|
@ -188,12 +195,14 @@ $(document).ready(function() {
|
|||
} else {
|
||||
//if form is invalid we only need to redraw the form
|
||||
$('#user_form').empty().append($(json.html).find('#user_form').children());
|
||||
$('#password').val("");
|
||||
$('#passwordVerify').val("");
|
||||
}
|
||||
setTimeout(removeSuccessMsg, 5000);
|
||||
sizeFormElements();
|
||||
});
|
||||
});
|
||||
|
||||
$("dt[id$='label']").addClass('user-form-label');
|
||||
$("dd[id$='element']").addClass('user-form-element');
|
||||
|
||||
sizeFormElements();
|
||||
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue