CC-4472: User password verify or clear text display.

-done with password verify
This commit is contained in:
denise 2013-01-10 17:51:25 -05:00
parent 86f57cb953
commit a129b0b081
7 changed files with 77 additions and 14 deletions

View File

@ -36,6 +36,16 @@ class Application_Form_AddUser extends Zend_Form
$password->addValidator($notEmptyValidator); $password->addValidator($notEmptyValidator);
$this->addElement($password); $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 = new Zend_Form_Element_Text('first_name');
$firstName->setLabel(_('Firstname:')); $firstName->setLabel(_('Firstname:'));
$firstName->setAttrib('class', 'input_text'); $firstName->setAttrib('class', 'input_text');

View File

@ -46,6 +46,17 @@ class Application_Form_EditUser extends Zend_Form
$password->setDecorators(array('viewHelper')); $password->setDecorators(array('viewHelper'));
$this->addElement($password); $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 = new Zend_Form_Element_Text('cu_first_name');
$firstName->setLabel(_('Firstname:')); $firstName->setLabel(_('Firstname:'));
$firstName->setValue($userData["first_name"]); $firstName->setValue($userData["first_name"]);

View File

@ -80,4 +80,17 @@ Class Application_Form_Helper_ValidationTypes {
return $validator; 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;
}
} }

View File

@ -10,7 +10,7 @@
<dd id="cu-username-element"> <dd id="cu-username-element">
<?php echo $this->element->getElement('cu_login') ?> <?php echo $this->element->getElement('cu_login') ?>
<?php if($this->element->getElement('cu_login')->hasErrors()) : ?> <?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): ?> <?php foreach($this->element->getElement('cu_login')->getMessages() as $error): ?>
<li><?php echo $error; ?></li> <li><?php echo $error; ?></li>
<?php endforeach; ?> <?php endforeach; ?>
@ -24,13 +24,27 @@
<dd id="cu-password-element"> <dd id="cu-password-element">
<?php echo $this->element->getElement('cu_password') ?> <?php echo $this->element->getElement('cu_password') ?>
<?php if($this->element->getElement('cu_password')->hasErrors()) : ?> <?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): ?> <?php foreach($this->element->getElement('cu_password')->getMessages() as $error): ?>
<li><?php echo $error; ?></li> <li><?php echo $error; ?></li>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php endif; ?> <?php endif; ?>
</dd> </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"> <dt id="cu-firstname-label">
<label><?php echo $this->element->getElement('cu_first_name')->getLabel() ?> <label><?php echo $this->element->getElement('cu_first_name')->getLabel() ?>
</label> </label>
@ -38,7 +52,7 @@
<dd id="cu-firstname-element"> <dd id="cu-firstname-element">
<?php echo $this->element->getElement('cu_first_name') ?> <?php echo $this->element->getElement('cu_first_name') ?>
<?php if($this->element->getElement('cu_first_name')->hasErrors()) : ?> <?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): ?> <?php foreach($this->element->getElement('cu_first_name')->getMessages() as $error): ?>
<li><?php echo $error; ?></li> <li><?php echo $error; ?></li>
<?php endforeach; ?> <?php endforeach; ?>
@ -52,7 +66,7 @@
<dd id="cu-lastname-element"> <dd id="cu-lastname-element">
<?php echo $this->element->getElement('cu_last_name') ?> <?php echo $this->element->getElement('cu_last_name') ?>
<?php if($this->element->getElement('cu_last_name')->hasErrors()) : ?> <?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): ?> <?php foreach($this->element->getElement('cu_last_name')->getMessages() as $error): ?>
<li><?php echo $error; ?></li> <li><?php echo $error; ?></li>
<?php endforeach; ?> <?php endforeach; ?>
@ -66,7 +80,7 @@
<dd id="cu-email-element"> <dd id="cu-email-element">
<?php echo $this->element->getElement('cu_email') ?> <?php echo $this->element->getElement('cu_email') ?>
<?php if($this->element->getElement('cu_email')->hasErrors()) : ?> <?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): ?> <?php foreach($this->element->getElement('cu_email')->getMessages() as $error): ?>
<li><?php echo $error; ?></li> <li><?php echo $error; ?></li>
<?php endforeach; ?> <?php endforeach; ?>
@ -80,7 +94,7 @@
<dd id="cu-cell_phone-element"> <dd id="cu-cell_phone-element">
<?php echo $this->element->getElement('cu_cell_phone') ?> <?php echo $this->element->getElement('cu_cell_phone') ?>
<?php if($this->element->getElement('cu_cell_phone')->hasErrors()) : ?> <?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): ?> <?php foreach($this->element->getElement('cu_cell_phone')->getMessages() as $error): ?>
<li><?php echo $error; ?></li> <li><?php echo $error; ?></li>
<?php endforeach; ?> <?php endforeach; ?>
@ -94,7 +108,7 @@
<dd id="cu-skype-element"> <dd id="cu-skype-element">
<?php echo $this->element->getElement('cu_skype') ?> <?php echo $this->element->getElement('cu_skype') ?>
<?php if($this->element->getElement('cu_skype')->hasErrors()) : ?> <?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): ?> <?php foreach($this->element->getElement('cu_skype')->getMessages() as $error): ?>
<li><?php echo $error; ?></li> <li><?php echo $error; ?></li>
<?php endforeach; ?> <?php endforeach; ?>
@ -108,7 +122,7 @@
<dd id="cu-jabber-element"> <dd id="cu-jabber-element">
<?php echo $this->element->getElement('cu_jabber') ?> <?php echo $this->element->getElement('cu_jabber') ?>
<?php if($this->element->getElement('cu_jabber')->hasErrors()) : ?> <?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): ?> <?php foreach($this->element->getElement('cu_jabber')->getMessages() as $error): ?>
<li><?php echo $error; ?></li> <li><?php echo $error; ?></li>
<?php endforeach; ?> <?php endforeach; ?>
@ -122,7 +136,7 @@
<dd id="cu-locale-element"> <dd id="cu-locale-element">
<?php echo $this->element->getElement('cu_locale') ?> <?php echo $this->element->getElement('cu_locale') ?>
<?php if($this->element->getElement('cu_locale')->hasErrors()) : ?> <?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): ?> <?php foreach($this->element->getElement('cu_locale')->getMessages() as $error): ?>
<li><?php echo $error; ?></li> <li><?php echo $error; ?></li>
<?php endforeach; ?> <?php endforeach; ?>
@ -136,7 +150,7 @@
<dd id="cu-timezone-element"> <dd id="cu-timezone-element">
<?php echo $this->element->getElement('cu_timezone') ?> <?php echo $this->element->getElement('cu_timezone') ?>
<?php if($this->element->getElement('cu_timezone')->hasErrors()) : ?> <?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): ?> <?php foreach($this->element->getElement('cu_timezone')->getMessages() as $error): ?>
<li><?php echo $error; ?></li> <li><?php echo $error; ?></li>
<?php endforeach; ?> <?php endforeach; ?>

View File

@ -2989,6 +2989,9 @@ dd .stream-status {
width: 200px; width: 200px;
} }
.edit-user-errors {
margin-left: 33% !important;
width: 208px;
.jp-container a#popup-link { .jp-container a#popup-link {
width: 104px; width: 104px;

View File

@ -448,12 +448,15 @@ function init() {
*/ */
function setCurrentUserPseudoPassword() { function setCurrentUserPseudoPassword() {
$('#cu_password').val("xxxxxx"); $('#cu_password').val("xxxxxx");
$('#cu_passwordVerify').val("xxxxxx");
} }
$(document).ready(function() { $(document).ready(function() {
if ($('#master-panel').length > 0) if ($('#master-panel').length > 0)
init(); init();
setCurrentUserPseudoPassword(); if ($('.errors').length === 0) {
setCurrentUserPseudoPassword();
}
$('#current-user').live('click', function() { $('#current-user').live('click', function() {
$.ajax({ $.ajax({

View File

@ -17,9 +17,11 @@ function populateForm(entries){
if (entries.id.length != 0){ if (entries.id.length != 0){
$('#login').attr('readonly', 'readonly'); $('#login').attr('readonly', 'readonly');
$('#password').val("xxxxxx"); $('#password').val("xxxxxx");
$('#passwordVerify').val("xxxxxx");
} else { } else {
$('#login').removeAttr('readonly'); $('#login').removeAttr('readonly');
$('#password').val(""); $('#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() { $(document).ready(function() {
populateUserTable(); populateUserTable();
@ -188,12 +195,14 @@ $(document).ready(function() {
} else { } else {
//if form is invalid we only need to redraw the form //if form is invalid we only need to redraw the form
$('#user_form').empty().append($(json.html).find('#user_form').children()); $('#user_form').empty().append($(json.html).find('#user_form').children());
$('#password').val("");
$('#passwordVerify').val("");
} }
setTimeout(removeSuccessMsg, 5000); setTimeout(removeSuccessMsg, 5000);
sizeFormElements();
}); });
}); });
$("dt[id$='label']").addClass('user-form-label'); sizeFormElements();
$("dd[id$='element']").addClass('user-form-element');
}); });