Version: current

# Class PasswordValidator

This class represents a validator for member passwords.

    $pwdVal = new PasswordValidator();
    $pwdValidator->minLength(7);
    $pwdValidator->checkHistoricalPasswords(6);
    $pwdValidator->characterStrength('lowercase','uppercase','digits','punctuation');

    Member::set_password_validator($pwdValidator);

  Object
  PasswordValidator

### Direct known subclasses

`NZGovtPasswordValidator`

Package: sapphire\security
Located at sapphire/security/PasswordValidator.php

## Methods summary

`public` | # `minLength( mixed $minLength )` Minimum password length Minimum password length
`public` | # `characterStrength( mixed $minScore, mixed $testNames )` Check the character strength of the password. Check the character strength of the password. Eg: $this->characterStrength(3, array("lowercase", "uppercase", "digits", "punctuation")) #### Parameters $minScore $minScore The minimum number of character tests that must pass $testNames $testNames The names of the tests to perform
`public` | # `checkHistoricalPasswords( mixed $count )` Check a number of previous passwords that the user has used, and don't let them change to that. Check a number of previous passwords that the user has used, and don't let them change to that.
`public` | # `validate( mixed $password, mixed $member )`

### Methods inherited from Object

`__call()`, `__construct()`, `__toString()`, `__wakeup()`, `addMethodsFrom()`, `addStaticVars()`, `addWrapperMethod()`, `add_extension()`, `add_static_var()`, `allMethodNames()`, `cacheToFile()`, `cacheToFileWithArgs()`, `clearCache()`, `combined_static()`, `create()`, `createMethod()`, `create_from_string()`, `defineMethods()`, `exists()`, `extInstance()`, `extend()`, `getCustomClass()`, `getExtensionInstance()`, `getExtensionInstances()`, `get_extensions()`, `get_static()`, `hasExtension()`, `hasMethod()`, `has_extension()`, `invokeWithExtensions()`, `is_a()`, `loadCache()`, `parentClass()`, `parse_class_spec()`, `remove_extension()`, `sanitiseCachename()`, `saveCache()`, `set_stat()`, `set_static()`, `set_uninherited()`, `stat()`, `strong_create()`, `uninherited()`, `uninherited_static()`, `useCustomClass()`

### Magic methods summary

## Properties summary

`public static array` | $character_strength_tests | #
`protected mixed` | $minLength | #
`protected mixed` | $minScore | #
`protected mixed` | $testNames | #
`protected mixed` | $historicalPasswordCount | #

### Properties inherited from Object

`$class`, `$extension_instances`, `$extensions`

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -