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