Compare commits

..

4 Commits

Author SHA1 Message Date
Guy Sartorelli
8737806cd8
Merge 94dc070f5ad2df4cc69309960d08ceabd3e39ff8 into 730b891e106e8abb999910be303547edd3d2dd77 2024-09-25 22:21:30 +00:00
Guy Sartorelli
94dc070f5a
ENH Use symfony/validation logic 2024-09-26 10:21:02 +12:00
Guy Sartorelli
730b891e10
Merge branch '5' into 6
# Conflicts:
#	src/Security/Member.php
#	src/Security/PasswordValidator.php
#	tests/php/Forms/ConfirmedPasswordFieldTest.php
2024-09-26 09:23:56 +12:00
Guy Sartorelli
e34463875a
DEP Deprecate API that will be removed or renamed (#11401) 2024-09-25 16:11:39 +12:00
3 changed files with 10 additions and 10 deletions

View File

@ -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())
);
}

View File

@ -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);