mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Allowing chaining on PasswordValidator
Allowing chaining on `PasswordValidator`. Also using injector pattern for `ValidationResult` instanciation
This commit is contained in:
parent
9b23e8c6c3
commit
974d575826
@ -31,6 +31,7 @@ class PasswordValidator extends Object {
|
||||
*/
|
||||
public function minLength($minLength) {
|
||||
$this->minLength = $minLength;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -44,6 +45,7 @@ class PasswordValidator extends Object {
|
||||
public function characterStrength($minScore, $testNames) {
|
||||
$this->minScore = $minScore;
|
||||
$this->testNames = $testNames;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,6 +53,7 @@ class PasswordValidator extends Object {
|
||||
*/
|
||||
public function checkHistoricalPasswords($count) {
|
||||
$this->historicalPasswordCount = $count;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -59,7 +62,7 @@ class PasswordValidator extends Object {
|
||||
* @return ValidationResult
|
||||
*/
|
||||
public function validate($password, $member) {
|
||||
$valid = new ValidationResult();
|
||||
$valid = ValidationResult::create();
|
||||
|
||||
if($this->minLength) {
|
||||
if(strlen($password) < $this->minLength) {
|
||||
|
Loading…
Reference in New Issue
Block a user