AbstractPasswordValidator
Abstract password validator class, which all TYPO3 password validators must extend.
Table of Contents
Properties
- $options : array<string|int, mixed>
Methods
- __construct() : mixed
- getErrorMessages() : array<string|int, mixed>
- Returns all error messages
- getRequirements() : array<string|int, mixed>
- Returns all requirements
- initializeRequirements() : void
- Function must be overwritten by extending classes in order to add requirements.
- validate() : bool
- Validates the given password. Function must be overwritten by extending classes.
- addErrorMessage() : void
- Adds an validation error message with the given identifier and message.
- addRequirement() : void
- Adds a requirement with the given identifier and message.
- getLanguageService() : LanguageService
Properties
$options
protected
array<string|int, mixed>
$options
= []
Methods
__construct()
public
__construct([array<string|int, mixed> $options = [] ]) : mixed
Parameters
- $options : array<string|int, mixed> = []
getErrorMessages()
Returns all error messages
public
final getErrorMessages() : array<string|int, mixed>
Return values
array<string|int, mixed>getRequirements()
Returns all requirements
public
final getRequirements() : array<string|int, mixed>
Return values
array<string|int, mixed>initializeRequirements()
Function must be overwritten by extending classes in order to add requirements.
public
initializeRequirements() : void
Use $this->addRequirement(string $identifier, string $message);
to add a requirement.
validate()
Validates the given password. Function must be overwritten by extending classes.
public
validate(string $password[, ContextData|null $contextData = null ]) : bool
If validation is considered as failed, use addErrorMessage(string $identifier, string $errorMessage)
to add an error message and return false
.
Parameters
- $password : string
-
The password to validate
- $contextData : ContextData|null = null
-
ContextData for usage in additional checks (e.g. password must not contain users firstname).
Return values
booladdErrorMessage()
Adds an validation error message with the given identifier and message.
protected
final addErrorMessage(string $identifier, string $errorMessage) : void
Parameters
- $identifier : string
-
Unique identifier for error message
- $errorMessage : string
-
Message describing the error (e.g. "The password must at least contain one digit")
addRequirement()
Adds a requirement with the given identifier and message.
protected
final addRequirement(string $identifier, string $message) : void
Parameters
- $identifier : string
-
Unique identifier for requirement
- $message : string
-
Message describing the requirement (e.g. "At least one digit")
getLanguageService()
protected
getLanguageService() : LanguageService