install_postfixadmin.sh: Change values 'password_validation' and add hook function 'adjust_plang_hook'.
This commit is contained in:
parent
9d943c4827
commit
12e2718447
@ -1937,8 +1937,98 @@ cat <<EOF >> $pfa_conf_file 2> $log_file
|
||||
'abuse' => 'postmaster@$DOMAIN',
|
||||
'postmaster' => 'postmaster@$DOMAIN'
|
||||
);
|
||||
|
||||
|
||||
EOF
|
||||
|
||||
|
||||
perl -i -n -p -e "s#^(\s*\\\$CONF\['language_hook'\]\s*=.*)#//\n//! 'language_hook' will be overridden - see end of configfile\n//\n\1#" \
|
||||
$pfa_conf_file >> $log_file 2>&1 || _failed=true
|
||||
|
||||
perl -i -n -p -e "s#^(\s*\\\$CONF\['password_validation'\]\s*=.*)#//\n//! 'password_validation' will be overridden - see end of configfile\n//\n\1#" \
|
||||
$pfa_conf_file >> $log_file 2>&1 || _failed=true
|
||||
|
||||
cat <<EOF >> $pfa_conf_file 2> $log_file
|
||||
// Password validation
|
||||
// New/changed passwords will be validated using all regular expressions in the array.
|
||||
// If a password doesn't match one of the regular expressions, the corresponding
|
||||
// error message from \$PALANG (see languages/*) will be displayed.
|
||||
// See http://de3.php.net/manual/en/reference.pcre.pattern.syntax.php for details
|
||||
// about the regular expression syntax.
|
||||
// If you need custom error messages, you can add them using \$CONF['language_hook'].
|
||||
// If a \$PALANG text contains a %s, you can add its value after the \$PALANG key
|
||||
// (separated with a space).
|
||||
\$CONF['password_validation'] = array(
|
||||
# minimum length 12 characters
|
||||
'/.{12}/' => 'password_too_short 12',
|
||||
# must contain at least 3 characters
|
||||
'/([a-zA-Z].*){3}/' => 'password_no_characters 3',
|
||||
# must contain at least 2 digits
|
||||
'/([0-9].*){2}/' => 'password_no_digits 2',
|
||||
# must contain at least 1 special character
|
||||
'/([!?~@#$\\%^&*\\(\\);\\':"\\.,<>{}\\[\\]|=\\-\\+_].*){1}/' => 'x_password_no_special_characters 1',
|
||||
# must NOT contain
|
||||
'/^[^¿¡§]*$/' => 'x_password_not_allowed',
|
||||
);
|
||||
|
||||
/*
|
||||
language_hook example function
|
||||
|
||||
Called if \$CONF['language_hook'] == '<name_of_the_function>'
|
||||
Allows to add or override \$PALANG interface texts.
|
||||
|
||||
If you add new texts, please always prefix them with 'x_' (for example
|
||||
\$PALANG['x_mytext'] = 'foo') to avoid they clash with texts that might be
|
||||
added to languages/*.lang in future versions of PostfixAdmin.
|
||||
|
||||
Please also make sure that all your added texts are included in all
|
||||
sections - that includes all 'case "XY":' sections and the 'default:'
|
||||
section (for users that don't have any of the languages specified
|
||||
in the 'case "XY":' section).
|
||||
Usually the 'default:' section should contain english text.
|
||||
|
||||
If you modify an existing text/translation, please consider to report it
|
||||
to the bugtracker on http://sf.net/projects/postfixadmin so that all users
|
||||
can benefit from the corrected text/translation.
|
||||
Returns: modified \$PALANG array
|
||||
|
||||
\$CONF['language_hook'] = "language_hook";
|
||||
|
||||
function language_hook(\$PALANG, \$language) {
|
||||
switch (\$language) {
|
||||
case "de":
|
||||
\$PALANG['x_whatever'] = 'foo';
|
||||
break;
|
||||
case "fr":
|
||||
\$PALANG['x_whatever'] = 'bar';
|
||||
break;
|
||||
default:
|
||||
\$PALANG['x_whatever'] = 'foobar';
|
||||
}
|
||||
return \$PALANG;
|
||||
}
|
||||
*/
|
||||
|
||||
// Hook to override or add translations in \$PALANG
|
||||
// Set to the function name you want to use as hook function (see language_hook example function below)
|
||||
\$CONF['language_hook'] = "adjust_plang_hook";
|
||||
|
||||
function adjust_plang_hook(\$PALANG, \$language) {
|
||||
switch (\$language) {
|
||||
case "de":
|
||||
\$PALANG['x_password_no_special_characters'] = 'Das Passwort muss mindestens %s Sonderzeichen (!~@#$^&*();\\':",.<>[]{}|=-+_) enhalten.';
|
||||
\$PALANG['x_password_not_allowed'] = 'Die Zeichen \'¿¡§\' sind nicht erlaubt.';
|
||||
break;
|
||||
default:
|
||||
\$PALANG['x_password_no_special_characters'] = 'Your password must contain at least %s special character (!~@#$^&*();\\':",.<>[]{}|=-+_).';
|
||||
\$PALANG['x_password_not_allowed'] = 'Characters \'¿¡§\' are not allowed.'
|
||||
}
|
||||
return \$PALANG;
|
||||
}
|
||||
|
||||
EOF
|
||||
|
||||
|
||||
perl -i -n -p -e "s#^(\s*\\\$CONF\['domain_path'\]\s*=.*)#//!\1\n\\\$CONF['domain_path'] = 'YES';#" \
|
||||
$pfa_conf_file >> $log_file 2>&1 || _failed=true
|
||||
perl -i -n -p -e "s#^(\s*\\\$CONF\['domain_in_mailbox'\]\s*=.*)#//!\1\n\\\$CONF['domain_in_mailbox'] = 'NO';#" \
|
||||
|
Loading…
x
Reference in New Issue
Block a user