diff --git a/airtime_mvc/application/forms/AddUser.php b/airtime_mvc/application/forms/AddUser.php
index 2b17b8b9d..ac7609f7a 100644
--- a/airtime_mvc/application/forms/AddUser.php
+++ b/airtime_mvc/application/forms/AddUser.php
@@ -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');
diff --git a/airtime_mvc/application/forms/EditUser.php b/airtime_mvc/application/forms/EditUser.php
index 7e9d78456..dea7f1f6c 100644
--- a/airtime_mvc/application/forms/EditUser.php
+++ b/airtime_mvc/application/forms/EditUser.php
@@ -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"]);
diff --git a/airtime_mvc/application/forms/helpers/ValidationTypes.php b/airtime_mvc/application/forms/helpers/ValidationTypes.php
index 6211a14b5..9f50e25b5 100644
--- a/airtime_mvc/application/forms/helpers/ValidationTypes.php
+++ b/airtime_mvc/application/forms/helpers/ValidationTypes.php
@@ -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;
+ }
+
}
\ No newline at end of file
diff --git a/airtime_mvc/application/views/scripts/form/edit-user.phtml b/airtime_mvc/application/views/scripts/form/edit-user.phtml
index 094cf440e..7f203035d 100644
--- a/airtime_mvc/application/views/scripts/form/edit-user.phtml
+++ b/airtime_mvc/application/views/scripts/form/edit-user.phtml
@@ -10,7 +10,7 @@
element->getElement('cu_login') ?>
element->getElement('cu_login')->hasErrors()) : ?>
-
+
element->getElement('cu_login')->getMessages() as $error): ?>
@@ -24,13 +24,27 @@
-
element->getElement('cu_password') ?>
element->getElement('cu_password')->hasErrors()) : ?>
-
+
element->getElement('cu_password')->getMessages() as $error): ?>
+ -
+
+
+ -
+ element->getElement('cu_passwordVerify') ?>
+ element->getElement('cu_passwordVerify')->hasErrors()) : ?>
+
+ element->getElement('cu_passwordVerify')->getMessages() as $error): ?>
+
+
+
+
+
-
@@ -38,7 +52,7 @@
-
element->getElement('cu_first_name') ?>
element->getElement('cu_first_name')->hasErrors()) : ?>
-
+
element->getElement('cu_first_name')->getMessages() as $error): ?>
@@ -52,7 +66,7 @@
-
element->getElement('cu_last_name') ?>
element->getElement('cu_last_name')->hasErrors()) : ?>
-
+
element->getElement('cu_last_name')->getMessages() as $error): ?>
@@ -66,7 +80,7 @@
-
element->getElement('cu_email') ?>
element->getElement('cu_email')->hasErrors()) : ?>
-
+
element->getElement('cu_email')->getMessages() as $error): ?>
@@ -80,7 +94,7 @@
-
element->getElement('cu_cell_phone') ?>
element->getElement('cu_cell_phone')->hasErrors()) : ?>
-
+
element->getElement('cu_cell_phone')->getMessages() as $error): ?>
@@ -94,7 +108,7 @@
-
element->getElement('cu_skype') ?>
element->getElement('cu_skype')->hasErrors()) : ?>
-
+
element->getElement('cu_skype')->getMessages() as $error): ?>
@@ -108,7 +122,7 @@
-
element->getElement('cu_jabber') ?>
element->getElement('cu_jabber')->hasErrors()) : ?>
-
+
element->getElement('cu_jabber')->getMessages() as $error): ?>
@@ -122,7 +136,7 @@
-
element->getElement('cu_locale') ?>
element->getElement('cu_locale')->hasErrors()) : ?>
-
+
element->getElement('cu_locale')->getMessages() as $error): ?>
@@ -136,7 +150,7 @@
-
element->getElement('cu_timezone') ?>
element->getElement('cu_timezone')->hasErrors()) : ?>
-
+
element->getElement('cu_timezone')->getMessages() as $error): ?>
diff --git a/airtime_mvc/public/css/styles.css b/airtime_mvc/public/css/styles.css
index 0815153ee..b2bb0867f 100644
--- a/airtime_mvc/public/css/styles.css
+++ b/airtime_mvc/public/css/styles.css
@@ -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;
diff --git a/airtime_mvc/public/js/airtime/dashboard/dashboard.js b/airtime_mvc/public/js/airtime/dashboard/dashboard.js
index eba3060b5..15bcbe87b 100644
--- a/airtime_mvc/public/js/airtime/dashboard/dashboard.js
+++ b/airtime_mvc/public/js/airtime/dashboard/dashboard.js
@@ -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({
diff --git a/airtime_mvc/public/js/airtime/user/user.js b/airtime_mvc/public/js/airtime/user/user.js
index 7b6fbd894..55155cda5 100644
--- a/airtime_mvc/public/js/airtime/user/user.js
+++ b/airtime_mvc/public/js/airtime/user/user.js
@@ -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();
});