PHP Class YiiPassword\Strategy

Inheritance: extends CValidator
Afficher le fichier Open project: phpnode/yiipassword

Méthodes publiques

Свойство Type Description
$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

Méthodes publiques

Méthode Description
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

Méthodes protégées

Méthode Description
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

Method Details

canUpgradeTo() public méthode

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
Résultat boolean true if this strategy can be upgraded to the given strategy

compare() public méthode

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
Résultat boolean true if the passwords are equal, otherwise false

encode() abstract public méthode

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
Résultat string the encoded password

generateSalt() protected méthode

Generates a random salt.
protected generateSalt ( ) : string | boolean
Résultat string | boolean the generated salt, or false if not supported by this strategy

getSalt() public méthode

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
Résultat string the generated salt

getUsername() public méthode

Gets the username to use with this strategt
public getUsername ( ) : string
Résultat string the username

setSalt() public méthode

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

setUsername() public méthode

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

validateAttribute() protected méthode

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.
Résultat boolean true if validation succeeded

Property Details

$daysValid public_oe property

Defaults to false, meaning passwords do not expire
public int|bool $daysValid
Résultat integer | boolean

$maxLength public_oe property

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
Résultat integer | boolean

$minDigits public_oe property

Defaults to 0 meaning no minimum.
public int $minDigits
Résultat integer

$minLength public_oe property

The minimum password length
public int $minLength
Résultat integer

$minLowerCaseLetters public_oe property

Defaults to 0 meaning no minimum.
public int $minLowerCaseLetters
Résultat integer

$minSpecialCharacters public_oe property

Defaults to 0 meaning no minimum.
public int $minSpecialCharacters
Résultat integer

$minUpperCaseLetters public_oe property

Defaults to 0 meaning no minimum.
public int $minUpperCaseLetters
Résultat integer

$name public_oe property

The name of this password strategy
public string $name
Résultat string

$specialCharacters public_oe property

The special characters that should appear in passwords if $minSpecialCharacters is set
public array $specialCharacters
Résultat array