mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 12:05:37 +00:00
Compare commits
4 Commits
80db2b4c83
...
8737806cd8
Author | SHA1 | Date | |
---|---|---|---|
|
8737806cd8 | ||
|
94dc070f5a | ||
|
730b891e10 | ||
|
e34463875a |
@ -211,10 +211,10 @@ class ConfirmedPasswordFieldTest extends SapphireTest
|
||||
return [
|
||||
'valid: within min and max' => [3, 8, true],
|
||||
'invalid: lower than min with max' => [8, 12, false, 'Passwords must be 8 to 12 characters long'],
|
||||
'valid: greater than min' => [3, null, true],
|
||||
'invalid: lower than min' => [8, null, false, 'Passwords must be at least 8 characters long'],
|
||||
'valid: less than max' => [null, 8, true],
|
||||
'invalid: greater than max' => [null, 4, false, 'Passwords must be at most 4 characters long'],
|
||||
'valid: greater than min' => [3, 0, true],
|
||||
'invalid: lower than min' => [8, 0, false, 'Passwords must be at least 8 characters long'],
|
||||
'valid: less than max' => [0, 8, true],
|
||||
'invalid: greater than max' => [0, 4, false, 'Passwords must be at most 4 characters long'],
|
||||
|
||||
];
|
||||
}
|
||||
@ -233,7 +233,7 @@ class ConfirmedPasswordFieldTest extends SapphireTest
|
||||
$this->assertFalse($result, 'Validate method should return its result');
|
||||
$this->assertFalse($validator->getResult()->isValid());
|
||||
$this->assertStringContainsString(
|
||||
'Passwords must have at least one digit and one alphanumeric character',
|
||||
'The password strength is too low. Please use a stronger password.',
|
||||
json_encode($validator->getResult()->__serialize())
|
||||
);
|
||||
}
|
||||
|
@ -1920,12 +1920,12 @@ class MemberTest extends FunctionalTest
|
||||
$member = new Member();
|
||||
// no password validator
|
||||
Member::set_password_validator(null);
|
||||
// password length is same as length argument
|
||||
// password length is min 128 chars long
|
||||
$password = $member->generateRandomPassword(5);
|
||||
$this->assertSame(5, strlen($password));
|
||||
// default to 20 if not length argument
|
||||
$password = $member->generateRandomPassword();
|
||||
$this->assertSame(20, strlen($password));
|
||||
$this->assertSame(128, strlen($password));
|
||||
// password length can be longer
|
||||
$password = $member->generateRandomPassword(130);
|
||||
$this->assertSame(130, strlen($password));
|
||||
// password validator
|
||||
$validator = new $validatorClass();
|
||||
Member::set_password_validator($validator);
|
||||
|
Loading…
x
Reference in New Issue
Block a user