PHP Класс Elgg\PasswordService

С версии: 1.10.0
Показать файл Открыть проект

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

Метод Описание
__construct ( ) Constructor
executeNewPasswordReset ( integer $user_guid, string $conf_code, string $password = null ) : boolean Validate and change password for a user.
forcePasswordReset ( ElggUser | integer $user, string $password ) : boolean Set a user's new password and save the entity.
generateHash ( string $password ) : string Hash a password for storage using password_hash()
needsRehash ( string $hash ) : boolean Determine if the password hash needs to be rehashed
sendNewPasswordRequest ( integer $user_guid ) : boolean Generate and send a password request email to a given user's registered email address.
verify ( string $password, string $hash ) : boolean Verify a password against a hash using a timing attack resistant approach

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

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

Constructor
public __construct ( )

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

Validate and change password for a user.
public executeNewPasswordReset ( integer $user_guid, string $conf_code, string $password = null ) : boolean
$user_guid integer The user id
$conf_code string Confirmation code as sent in the request email.
$password string Optional new password, if not randomly generated.
Результат boolean True on success

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

This can only be called from execute_new_password_request().
public forcePasswordReset ( ElggUser | integer $user, string $password ) : boolean
$user ElggUser | integer The user GUID or entity
$password string Text (which will then be converted into a hash and stored)
Результат boolean

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

Hash a password for storage using password_hash()
public generateHash ( string $password ) : string
$password string Password in clear text
Результат string

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

If the answer is true, after validating the password using password_verify, rehash it.
public needsRehash ( string $hash ) : boolean
$hash string The hash to test
Результат boolean True if the password needs to be rehashed.

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

Generate and send a password request email to a given user's registered email address.
public sendNewPasswordRequest ( integer $user_guid ) : boolean
$user_guid integer User GUID
Результат boolean

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

Verify a password against a hash using a timing attack resistant approach
public verify ( string $password, string $hash ) : boolean
$password string The password to verify
$hash string The hash to verify against
Результат boolean If the password matches the hash