PHP Класс YiiPassword\Strategy

Наследование: extends CValidator
Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
$daysValid integer | boolean Defaults to false, meaning passwords do not expire
$maxLength integer | boolean There is no good reason to set this value unless you're using it for legacy authentication Defaults to false meaning no maximum password length.
$minDigits integer Defaults to 0 meaning no minimum.
$minLength integer The minimum password length
$minLowerCaseLetters integer Defaults to 0 meaning no minimum.
$minSpecialCharacters integer Defaults to 0 meaning no minimum.
$minUpperCaseLetters integer Defaults to 0 meaning no minimum.
$name string The name of this password strategy
$specialCharacters array The special characters that should appear in passwords if $minSpecialCharacters is set

Открытые методы

Метод Описание
canUpgradeTo ( Strategy $strategy ) : boolean Checks whether this strategy can be upgraded to another given strategy.
compare ( string $password, string $encoded ) : boolean Compare a plain text password to the given encoded password
encode ( string $password ) : string Encode a plain text password.
getSalt ( boolean $forceRefresh = false ) : string Gets the salt to use with this strategy, if supported.
getUsername ( ) : string Gets the username to use with this strategt
setSalt ( string $salt ) Sets the salt to use with this strategy, if supported
setUsername ( string $username ) Sets the username to use with this strategy

Защищенные методы

Метод Описание
generateSalt ( ) : string | boolean Generates a random salt.
validateAttribute ( CModel $object, string $attribute ) : boolean Validates a new password to ensure that it meets the minimum complexity requirements

Описание методов

canUpgradeTo() публичный Метод

If this strategy's complexity requirements are equal or greater than that of the given strategy, then it can be upgraded. Otherwise the user must be prompted to enter a new password that meets the complexity requirements.
public canUpgradeTo ( Strategy $strategy ) : boolean
$strategy Strategy the strategy to upgrade to
Результат boolean true if this strategy can be upgraded to the given strategy

compare() публичный Метод

Compare a plain text password to the given encoded password
public compare ( string $password, string $encoded ) : boolean
$password string the plain text password to compare
$encoded string the encoded password to compare to
Результат boolean true if the passwords are equal, otherwise false

encode() абстрактный публичный Метод

Child classes should implement this method and do their encoding here
abstract public encode ( string $password ) : string
$password string the plain text password to encode
Результат string the encoded password

generateSalt() защищенный Метод

Generates a random salt.
protected generateSalt ( ) : string | boolean
Результат string | boolean the generated salt, or false if not supported by this strategy

getSalt() публичный Метод

Gets the salt to use with this strategy, if supported.
public getSalt ( boolean $forceRefresh = false ) : string
$forceRefresh boolean whether to force generate a new salt
Результат string the generated salt

getUsername() публичный Метод

Gets the username to use with this strategt
public getUsername ( ) : string
Результат string the username

setSalt() публичный Метод

Sets the salt to use with this strategy, if supported
public setSalt ( string $salt )
$salt string the salt

setUsername() публичный Метод

Sets the username to use with this strategy
public setUsername ( string $username )
$username string the username

validateAttribute() защищенный Метод

Validates a new password to ensure that it meets the minimum complexity requirements
protected validateAttribute ( CModel $object, string $attribute ) : boolean
$object CModel the data object being validated
$attribute string the name of the attribute to be validated.
Результат boolean true if validation succeeded

Описание свойств

$daysValid публичное свойство

Defaults to false, meaning passwords do not expire
public int|bool $daysValid
Результат integer | boolean

$maxLength публичное свойство

There is no good reason to set this value unless you're using it for legacy authentication Defaults to false meaning no maximum password length.
public int|bool $maxLength
Результат integer | boolean

$minDigits публичное свойство

Defaults to 0 meaning no minimum.
public int $minDigits
Результат integer

$minLength публичное свойство

The minimum password length
public int $minLength
Результат integer

$minLowerCaseLetters публичное свойство

Defaults to 0 meaning no minimum.
public int $minLowerCaseLetters
Результат integer

$minSpecialCharacters публичное свойство

Defaults to 0 meaning no minimum.
public int $minSpecialCharacters
Результат integer

$minUpperCaseLetters публичное свойство

Defaults to 0 meaning no minimum.
public int $minUpperCaseLetters
Результат integer

$name публичное свойство

The name of this password strategy
public string $name
Результат string

$specialCharacters публичное свойство

The special characters that should appear in passwords if $minSpecialCharacters is set
public array $specialCharacters
Результат array