Index: branches/5.0.x/core/kernel/utility/formatters/password_formatter.php =================================================================== diff -u -r12117 -r12279 --- branches/5.0.x/core/kernel/utility/formatters/password_formatter.php (.../password_formatter.php) (revision 12117) +++ branches/5.0.x/core/kernel/utility/formatters/password_formatter.php (.../password_formatter.php) (revision 12279) @@ -1,6 +1,6 @@ GetDBField($password_field) != $this->EncryptPassword('', $salt) ) - { - if ($options['encryption_method'] == 'plain') return $value; + if( $object->GetDBField($password_field) != $this->EncryptPassword('', $salt) ) { + if ($options['encryption_method'] == 'plain') { + return $value; + } + return $this->EncryptPassword($value); } - else - { + else { $object->Fields[$password_field.'_plain']['required'] = true; $object->Fields[$verify_field.'_plain']['required'] = true; + return null; } } - $min_length = $this->Application->ConfigValue('Min_Password'); - if (mb_strlen($new_password) >= $min_length) { - if ($new_password != $verify_password) { - $object->SetError($password_field, 'passwords_do_not_match', 'lu_passwords_do_not_match'); - $object->SetError($verify_field, 'passwords_do_not_match', 'lu_passwords_do_not_match'); - } + if ($new_password != $verify_password) { + // passwords don't match (no matter what is their length) + $object->SetError($verify_field, 'passwords_do_not_match', 'lu_passwords_do_not_match'); } - else { - $error_msg = '+'.sprintf($this->Application->Phrase('lu_passwords_too_short'), $min_length); // + -> not phrase + + $min_length = $this->Application->ConfigValue('Min_Password'); // for error message too + + if (mb_strlen($new_password) < $min_length) { + $error_msg = '+' . sprintf($this->Application->Phrase('lu_passwords_too_short'), $min_length); // + -> not phrase $object->SetError($password_field, 'passwords_min_length', $error_msg); - $object->SetError($verify_field, 'passwords_min_length', $error_msg); } } if($value == '') return $object->GetDBField($field_name);