mirror of
https://github.com/postfixadmin/postfixadmin.git
synced 2024-09-19 19:22:14 +02:00
one or more of something needs {1,} not {1} ...
This commit is contained in:
parent
de23080c79
commit
760600cb56
@ -240,7 +240,7 @@ $CONF['password_validation'] = array(
|
||||
'/.{5}/' => 'password_too_short 5', # 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}/' => 'password_no_special 1', # must contain at least 1 special character
|
||||
# '/([!\".,*&^%$£)(_+=\-`\'#@~\[\]\\<>\/].*){1,}/' => 'password_no_special 1', # must contain at least 1 special character
|
||||
|
||||
/* support a 'callable' value which if it returns a non-empty string will be assumed to have failed, non-empty string should be a PALANG key */
|
||||
// 'length_check' => function($password) { if (strlen(trim($password)) < 3) { return 'password_too_short'; } },
|
||||
|
@ -27,12 +27,13 @@ class ValidatePasswordTest extends \PHPUnit\Framework\TestCase
|
||||
|
||||
// Set to the defaults, just to make sure.
|
||||
Config::write('password_validation', array(
|
||||
'/([!\".,*&^%$£)(_+=\-`\'#@~\[\]\\<>\/].*){2}/' => 'password_no_special 1', # must contain at least 1 special character
|
||||
'/([!\".,*&^%$£)(_+=\-`\'#@~\[\]\\<>\/].*){1,}/' => 'password_no_special 1', # must contain at least 1 special character
|
||||
));
|
||||
|
||||
$this->assertEmpty(validate_password('fish^Sh$$p01'));
|
||||
$this->assertEmpty(validate_password(']/>'));
|
||||
$this->assertEmpty(validate_password("P'55w\ord"));
|
||||
$this->assertNotEmpty(validate_password("fish'Sheep01"));
|
||||
$this->assertEmpty(validate_password("P'55w\\ord"));
|
||||
$this->assertEmpty(validate_password("P'55word"), "should contain 1 special char");
|
||||
$this->assertNotEmpty(validate_password("fishSheep01"), "does not contain any special chars...");
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user