Class Password
Responsibility: Validate raw user password by configured password strength rules. Password still could contain very dangerous characters for XSS, SQL or any other attacks. Be careful!!! This doesn't escape everything. It only check if configured character groups are presented and how much and that's all.
- MvcCore\Ext\Forms\Validator implements MvcCore\Ext\Forms\IValidator
-
MvcCore\Ext\Forms\Validators\Password
Located at ext-form-field-text/src/MvcCore/Ext/Forms/Validators/Password.php
public
integer
|
|
public
|
#
SetMustHaveMinLength( integer $mustHaveMinLength = self::MIN_LENGTH )
Set global minimum password characters length, default value is 12. |
public
integer
|
|
public
|
#
SetMustHaveMaxLength( integer $mustHaveMaxLength = self::MAX_LENGTH )
Set global maximum password characters length, default value is 255. |
public
array
|
#
GetMustHaveLowerCaseChars( boolean $getWithMinCount = TRUE )
Get password strength rule to have any lower case character presented in password.
Default value is |
public
|
#
SetMustHaveLowerCaseChars( boolean $mustHaveLowerCaseChars = TRUE, integer $minCount = self::MIN_LOWERCASE_CHARS_COUNT )
Set password strength rule to have any lower case character presented in password.
Default value is |
public
array
|
#
GetMustHaveUpperCaseChars( boolean $getWithMinCount = TRUE )
Get password strength rule to have any upper case character presented in password.
Default value is |
public
|
#
SetMustHaveUpperCaseChars( boolean $mustHaveUpperCaseChars = TRUE, integer $minCount = self::MIN_UPPERCASE_CHARS_COUNT )
Set password strength rule to have any upper case character presented in password.
Default value is |
public
array|boolean
|
#
GetMustHaveDigits( boolean $getWithMinCount = TRUE )
Get password strength rule to have any digit presented in password.
Default value is |
public
|
#
SetMustHaveDigits( boolean $mustHaveDigits = TRUE, integer $minCount = self::MIN_DIGIT_CHARS_COUNT )
Set password strength rule to have any digit presented in password.
Default value is |
public
array|boolean
|
#
GetMustHaveSpecialChars( boolean $getWithMinCount = TRUE )
Get password strength rule to have any special character presented in password.
Default value is |
public
|
#
SetMustHaveSpecialChars( boolean $mustHaveSpecialChars = TRUE, integer $minCount = self::MIN_SPECIAL_CHARS_COUNT )
Set password strength rule to have any special character presented in password.
Default value is |
public
string
|
#
GetSpecialChars( )
Get special characters collection to check if any of them is presented in password. Default special characters are: !"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~. |
public
|
#
SetSpecialChars( string $specialChars = self::SPECIAL_CHARS )
Set special characters collection to check if any of them is presented in password. Default special characters are: !"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~. |
public
|
#
__construct( array $cfg = [] )
Create new password strength rules validator instance. This validator accepts first argument to be an array with camel case keyed records representing protected properties (password strength rules) you need to configure. Example:
|
public
string|null
|
CreateInstance(),
GetErrorMessage(),
SetField(),
SetForm(),
setUpFieldProps(),
throwNewInvalidArgumentException()
|
integer |
MIN_LENGTH
Default minimum password characters length - 12. |
#
12
|
integer |
MAX_LENGTH
Default maximum password characters length - 255. |
#
255
|
string |
SPECIAL_CHARS
Default special characters collection - !"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~. |
#
'!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~'
|
integer |
MIN_LOWERCASE_CHARS_COUNT
Default lower case chars count presented in password - 1; |
#
1
|
integer |
MIN_UPPERCASE_CHARS_COUNT
Default upper case chars count presented in password - 1; |
#
1
|
integer |
MIN_DIGIT_CHARS_COUNT
Default digit chars count presented in password - 1; |
#
1
|
integer |
MIN_SPECIAL_CHARS_COUNT
Default special chars count presented in password - 1; |
#
1
|
integer |
ERROR_MIN_LENGTH
Error message index(es). |
#
0
|
integer |
ERROR_MAX_LENGTH
|
#
1
|
integer |
ERROR_LOWERCASE_CHARS
|
#
2
|
integer |
ERROR_LOWERCASE_CHARS_MIN
|
#
3
|
integer |
ERROR_UPPERCASE_CHARS
|
#
4
|
integer |
ERROR_UPPERCASE_CHARS_MIN
|
#
5
|
integer |
ERROR_DIGIT_CHARS
|
#
6
|
integer |
ERROR_DIGIT_CHARS_MIN
|
#
7
|
integer |
ERROR_SPECIAL_CHARS
|
#
8
|
integer |
ERROR_SPECIAL_CHARS_MIN
|
#
9
|
protected
integer
|
$mustHaveMinLength
Global minimum password characters length, default value is 12. |
#
self::MIN_LENGTH
|
protected
integer
|
$mustHaveMaxLength
Global maximum password characters length, default value is 255. |
#
self::MAX_LENGTH
|
protected
boolean
|
$mustHaveLowerCaseChars
Password strength rule to have any lower case character presented in password.
Default value is |
#
TRUE
|
protected
integer
|
$mustHaveLowerCaseCharsCount
Password strength rule to have minimum lower case characters count presented in password.
Default value is |
#
self::MIN_LOWERCASE_CHARS_COUNT
|
protected
boolean
|
$mustHaveUpperCaseChars
Password strength rule to have any upper case character presented in password.
Default value is |
#
TRUE
|
protected
integer
|
$mustHaveUpperCaseCharsCount
Password strength rule to have minimum upper case characters count presented in password.
Default value is |
#
self::MIN_UPPERCASE_CHARS_COUNT
|
protected
boolean
|
$mustHaveDigits
Password strength rule to have any digit presented in password.
Default value is |
#
TRUE
|
protected
integer
|
$mustHaveDigitsCount
Password strength rule to have minimum digits count presented in password.
Default value is |
#
self::MIN_DIGIT_CHARS_COUNT
|
protected
boolean
|
$mustHaveSpecialChars
Password strength rule to have any special character presented in password.
Default value is |
#
TRUE
|
protected
integer
|
$mustHaveSpecialCharsCount
Password strength rule to have minimum special characters count presented in password.
Default value is |
#
self::MIN_SPECIAL_CHARS_COUNT
|
protected
string
|
$specialChars
Special characters collection to check if any of them is presented in password. Default special characters are: !"#$%&\'()*+,-./:;<=>?@[\]^_`{|}~. |
#
self::SPECIAL_CHARS
|
protected static
array
|
$errorMessages
Validation failure message template definitions. |
#
[
self::ERROR_MIN_LENGTH => "Password must have a minimum length of {1} characters.",
self::ERROR_MAX_LENGTH => "Password must have a maximum length of {1} characters.",
self::ERROR_LOWERCASE_CHARS => "Password must contain lower case characters ({1}).",
self::ERROR_LOWERCASE_CHARS_MIN => "Password must contain at minimum {1} lower case characters ({2}).",
self::ERROR_UPPERCASE_CHARS => "Password must contain upper case characters ({1}).",
self::ERROR_UPPERCASE_CHARS_MIN => "Password must contain at minimum {1} upper case characters ({2}).",
self::ERROR_DIGIT_CHARS => "Password must contain digits ({1}).",
self::ERROR_DIGIT_CHARS_MIN => "Password must contain at minimum {1} digits ({2}).",
self::ERROR_SPECIAL_CHARS => "Password must contain special characters ( {1} ).",
self::ERROR_SPECIAL_CHARS_MIN => "Password must contain at minimum {1} special characters ( {2} ).",
]
|
$field,
$fieldSpecificProperties,
$form,
$toolClass
|