PFAHandler:

- add function compare_password_fields() - compares if two fields contain
  the same password (based on _field_password2() from AdminHandler)
  and use pEdit_mailbox_password_text_error as error message because it
  doesn't contain "... or empty"

AdminHandler:
- replace _field_password2() with a call to $this->compare_password_fields()


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1361 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 13 years ago
parent 56a8d1c52f
commit 306c5a9688

@ -213,13 +213,7 @@ class AdminHandler extends PFAHandler {
* error message will be displayed at the password2 field
*/
protected function _field_password2($field, $val) {
if ($this->RAWvalues['password'] == $this->RAWvalues['password2']) {
unset ($this->errormsg['password2']); # no need to warn about too short etc. passwords - it's enough to display this message at the 'password' field
return true;
}
$this->errormsg['password2'] = Lang::read('pAdminEdit_admin_password_text_error');
return false;
return $this->compare_password_fields('password', 'password2');
}
}

@ -346,6 +346,22 @@ class PFAHandler {
}
/**
* compare two password fields
* typically called from _field_password2()
* @param string $field1 - "password" field
* @param string $field2 - "repeat password" field
*/
protected function compare_password_fields($field1, $field2) {
if ($this->RAWvalues[$field1] == $this->RAWvalues[$field2]) {
unset ($this->errormsg[$field2]); # no need to warn about too short etc. passwords - it's enough to display this message at the 'password' field
return true;
}
$this->errormsg[$field2] = Lang::read('pEdit_mailbox_password_text_error');
return false;
}
/**************************************************************************
* functions for basic input validation
*/

Loading…
Cancel
Save