您能帮我向 Postfixadmin 添加自定义错误吗?在 config.local.php 文件中,我将以下内容添加到 $CONF['password_validation'] = array()
'/([-#*.!@$%^&(){}:;<>,.?~_+=|].*){1}/' => 'x_no_special',
Regexp 工作正常,现在我想添加错误描述。我按照手册操作,在数组后添加:
$CONF['language_hook'] = 'x_no_special';
$PALANG['x_no_special'] = "123";
但没有显示任何错误。如果我直接将 $PALANG['x_no_special'] = "123" 添加到 /languages/en.lang,则一切正常
我的配置文件如下:
<?php
$CONF['password_validation'] = array(
'/.{8}/' => 'password_too_short 8', # minimum length 5 characters
'/([a-zA-Z].*){3}/' => 'password_no_characters 3', # must contain at least 3 characters
'/([0-9].*){2}/' => 'password_no_digits 2', # must contain at least 2 digits
'/([-#*.!@$%^&(){}:;<>,.?~_+=|].*){1}/' => 'x_no_special', #CUSTOM must contain at least 1 special character
);
$CONF['language_hook'] = 'x_no_special';
$PALANG['x_no_special'] = "123";
?>
答案1
$CONF['language_hook'] = 'x_password_no_special';
function x_password_no_special($PALANG, $language) {
$PALANG['x_password_no_special'] = '123';
return $PALANG;
}