Custom error in Postfixadmin

es flag

can you please help me to add a custom error to Postfixadmin. In the config.local.php file I add the following to $CONF['password_validation'] = array()

'/([-#*.!@$%^&(){}:;<>,.?~_+=|].*){1}/' => 'x_no_special',

Regexp works ok, now I want to add a description of the error. I do it like according to the manual, I add after the array:

$CONF['language_hook'] = 'x_no_special';
$PALANG['x_no_special'] = "123"; 

But no error is not showing. If I directly add $PALANG['x_no_special'] = "123" to /languages/en.lang then everything is ok

My config file looks like:

$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";
es flag
$CONF['language_hook'] = 'x_password_no_special';

function x_password_no_special($PALANG, $language) {
$PALANG['x_password_no_special'] = '123';

return $PALANG;
in flag
Can you add some text to explain why this is the solution? This would help others with the same problem to understand your Q&A here.
cozby avatar
es flag
If you want to make a description of the error without editing /lang/*.lang (which is what you should do) Then this is supposed to be done through $CONF['language_hook'], it waits for the name of the function, which we will describe below
in flag
You can edit the answer to include the explanation, so it is a full solution. And after 2 days you can then accept your own answer, so the Q&A pair will help others with the problem.
I sit in a Tesla and translated this thread with Ai:


Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.