2019-08-15 07:11:43 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace SilverStripe\Security\Tests\MemberTest;
|
|
|
|
|
|
|
|
use SilverStripe\Dev\TestOnly;
|
2024-09-23 04:31:50 +02:00
|
|
|
use SilverStripe\Core\Validation\ValidationResult;
|
2019-08-15 07:11:43 +02:00
|
|
|
use SilverStripe\Security\PasswordValidator;
|
|
|
|
|
|
|
|
class VerySpecificPasswordValidator extends PasswordValidator implements TestOnly
|
|
|
|
{
|
|
|
|
public function validate($password, $member)
|
|
|
|
{
|
|
|
|
$result = ValidationResult::create();
|
2022-04-14 03:12:59 +02:00
|
|
|
if (strlen($password ?? '') !== 17) {
|
2019-08-15 07:11:43 +02:00
|
|
|
$result->addError('Password must be 17 characters long');
|
|
|
|
}
|
|
|
|
return $result;
|
|
|
|
}
|
|
|
|
}
|