Property | Type | Description | |
---|---|---|---|
$autoUpgrade | boolean | If this is true, user passwords will be reencoded with the new strategy when they successfully authenticate with an old strategy. | |
$defaultStrategyName | string | The name of the default password strategy | |
$passwordAttribute | string | The name of the attribute that contains the encoded password | |
$requireNewPasswordAttribute | string | The name of the attribute that determines whether a user requires a new password or not | |
$saltAttribute | string | The name of the attribute that contains the password salt | |
$strategyAttribute | string | The name of the attribute that contains the password strategy name | |
$usernameAttribute | string | The name of the username attribute |
Property | Type | Description | |
---|---|---|---|
$_strategies | array | array( "hash" => array( "class" => "YiiPassword\Strategies\Hash", "hashMethod" => array("sha1"), "workFactor" => 50 ), "md5" => array( "class" => "YiiPassword\Strategies\LegacyMd5" ), ) |
Method | Description | |
---|---|---|
afterFind ( CModelEvent $event ) | Invoked after the model is found, stores the hashed user password | |
beforeSave ( CModelEvent $event ) | Invoked before the model is saved, re hashes the password if required | |
beforeValidate ( CModelEvent $event ) | Invoked before the model is validated. | |
changePassword ( string $newPassword, boolean $runValidation = true ) : boolean | Changes the user's password and saves the record | |
getDefaultStrategy ( ) : APasswordStrategy | boolean | Gets the default password strategy | |
getPasswordResetCode ( ) : string | Generates a password reset code to use for this user. | |
getStrategies ( ) : array | Gets the password strategies | |
getStrategy ( ) : APasswordStrategy | boolean | Gets the password strategy to use for this model | |
setStrategies ( |
Sets the strategies to use | |
verifyPassword ( string $password ) : boolean | Compares the given password to the stored password for this model |
Method | Description | |
---|---|---|
changePasswordInternal ( string $password ) | Changes the user's password but doesn't perform any saving |
public afterFind ( CModelEvent $event ) | ||
$event | CModelEvent | the raised event |
public beforeSave ( CModelEvent $event ) | ||
$event | CModelEvent | the raised event |
public beforeValidate ( CModelEvent $event ) | ||
$event | CModelEvent | the raised event |
public changePassword ( string $newPassword, boolean $runValidation = true ) : boolean | ||
$newPassword | string | the plain text password to change to |
$runValidation | boolean | whether to run validation or not. If validate false, return false, and {UserModel} hasError(password). |
return | boolean | true if the password was changed successfully |
protected changePasswordInternal ( string $password ) | ||
$password | string | the password to change to |
public getDefaultStrategy ( ) : APasswordStrategy | boolean | ||
return | APasswordStrategy | boolean | the default password strategy, or false if none is configured |
public getPasswordResetCode ( ) : string | ||
return | string | the password reset code |
public getStrategies ( ) : array | ||
return | array | the password strategies |
public getStrategy ( ) : APasswordStrategy | boolean | ||
return | APasswordStrategy | boolean | the password strategy, or false if none are configured |
public setStrategies ( |
||
$strategies | the strategies to add |
public verifyPassword ( string $password ) : boolean | ||
$password | string | the plain text password to check |
return | boolean | true if the password matches, otherwise false |
array( "hash" => array( "class" => "YiiPassword\Strategies\Hash", "hashMethod" => array("sha1"), "workFactor" => 50 ), "md5" => array( "class" => "YiiPassword\Strategies\LegacyMd5" ), )
protected array $_strategies | ||
return | array |
public bool $autoUpgrade | ||
return | boolean |
public string $defaultStrategyName | ||
return | string |
public string $passwordAttribute | ||
return | string |
public string $requireNewPasswordAttribute | ||
return | string |
public string $saltAttribute | ||
return | string |
public string $strategyAttribute | ||
return | string |
public string $usernameAttribute | ||
return | string |