functions.inc.php:

- validate_password(): use Config::read and Lang::read instead of 
  $CONF and $PALANG


git-svn-id: https://svn.code.sf.net/p/postfixadmin/code/trunk@1439 a1433add-5e2c-0410-b055-b7f2511e0802
pull/2/head
Christian Boltz 12 years ago
parent be84a8b8fc
commit 74deef8221

@ -1003,25 +1003,25 @@ function generate_password () {
* @return array of error messages, or empty array if the password is ok * @return array of error messages, or empty array if the password is ok
*/ */
function validate_password($password) { function validate_password($password) {
global $CONF; $val_conf = Config::read('password_validation');
global $PALANG;
$result = array(); $result = array();
if (isset($CONF['min_password_length'])) { # used up to 2.3.x - check it for backward compatibility $minlen = (int) Config::read('min_password_length'); # used up to 2.3.x - check it for backward compatibility
$minlen = (int) $CONF['min_password_length']; if ($minlen > 0) {
$CONF['password_validation']['/.{' . $minlen . '}/'] = "password_too_short $minlen"; $val_conf['/.{' . $minlen . '}/'] = "password_too_short $minlen";
} }
foreach ($CONF['password_validation'] as $regex => $message) { foreach ($val_conf as $regex => $message) {
if (!preg_match($regex, $password)) { if (!preg_match($regex, $password)) {
$msgparts = preg_split("/ /", $message, 2); $msgparts = preg_split("/ /", $message, 2);
if (count($msgparts) == 1) { if (count($msgparts) == 1) {
$result[] = $PALANG[$msgparts[0]]; $result[] = Lang::read($msgparts[0]);
} else { } else {
$result[] = sprintf($PALANG[$msgparts[0]], $msgparts[1]); $result[] = sprintf(Lang::read($msgparts[0]), $msgparts[1]);
} }
} }
} }
return $result; return $result;
} }

Loading…
Cancel
Save