Elgg  Version 4.3
Public Member Functions | List of all members
Elgg\PasswordService Class Reference

Password service. More...

Public Member Functions

 __construct ()
 Constructor. More...
 
 needsRehash (string $hash)
 Determine if the password hash needs to be rehashed. More...
 
 verify (string $password, string $hash)
 Verify a password against a hash using a timing attack resistant approach. More...
 
 generateHash (string $password)
 Hash a password for storage using password_hash() More...
 
 sendNewPasswordRequest ($user_guid)
 Generate and send a password request email to a given user's registered email address. More...
 
 requestNewPassword (\ElggUser $user)
 Generate and send a password request email to a given user's registered email address. More...
 
 forcePasswordReset ($user, $password)
 Set a user's new password and save the entity. More...
 
 saveNewPassword (\ElggUser $user, string $conf_code, string $password=null)
 Validate and change password for a user. More...
 

Detailed Description

Password service.

Definition at line 13 of file PasswordService.php.

Constructor & Destructor Documentation

Elgg\PasswordService::__construct ( )

Constructor.

Exceptions
RuntimeException

Definition at line 20 of file PasswordService.php.

Member Function Documentation

Elgg\PasswordService::forcePasswordReset (   $user,
  $password 
)

Set a user's new password and save the entity.

Parameters
\ElggUser | int$userThe user GUID or entity
string$passwordText (which will then be converted into a hash and stored)
Returns
bool

Definition at line 164 of file PasswordService.php.

Elgg\PasswordService::generateHash ( string  $password)

Hash a password for storage using password_hash()

Parameters
string$passwordPassword in clear text
Returns
string|false

Definition at line 58 of file PasswordService.php.

Elgg\PasswordService::needsRehash ( string  $hash)

Determine if the password hash needs to be rehashed.

If the answer is true, after validating the password using password_verify, rehash it.

Parameters
string$hashThe hash to test
Returns
bool

Definition at line 35 of file PasswordService.php.

Elgg\PasswordService::requestNewPassword ( \ElggUser  $user)

Generate and send a password request email to a given user's registered email address.

Parameters
\ElggUser$userthe user to notify
Returns
void

Definition at line 120 of file PasswordService.php.

Elgg\PasswordService::saveNewPassword ( \ElggUser  $user,
string  $conf_code,
string  $password = null 
)

Validate and change password for a user.

Parameters
\ElggUser$userThe user
string$conf_codeConfirmation code as sent in the request email.
string$passwordOptional new password, if not randomly generated.
Returns
bool
Since
4.3

Definition at line 190 of file PasswordService.php.

Elgg\PasswordService::sendNewPasswordRequest (   $user_guid)

Generate and send a password request email to a given user's registered email address.

Parameters
int$user_guidUser GUID
Returns
false|array
See also
notify_user()

Definition at line 72 of file PasswordService.php.

Elgg\PasswordService::verify ( string  $password,
string  $hash 
)

Verify a password against a hash using a timing attack resistant approach.

Parameters
string$passwordThe password to verify
string$hashThe hash to verify against
Returns
bool

Definition at line 47 of file PasswordService.php.


The documentation for this class was generated from the following file: