17 if (!function_exists(
'password_hash')) {
18 throw new \RuntimeException(
"password_hash and associated functions are required.");
32 return password_needs_rehash($hash, PASSWORD_DEFAULT);
55 return password_hash(
$password, PASSWORD_DEFAULT);
87 $user->setPrivateSetting(
'passwd_conf_code',
$code);
88 $user->setPrivateSetting(
'passwd_conf_time', time());
91 $link =
_elgg_services()->config->getSiteUrl() .
"changepassword?u=$user_guid&c=$code";
96 'email:changereq:body', array(
$user->name, $ip_address, $link),
$user->language);
98 'email:changereq:subject', array(),
$user->language);
154 $saved_code =
$user->getPrivateSetting(
'passwd_conf_code');
155 $code_time = (int)
$user->getPrivateSetting(
'passwd_conf_time');
156 $codes_match =
_elgg_services()->crypto->areEqual($saved_code, $conf_code);
158 if (!$saved_code || !$codes_match) {
163 if (!$code_time || $code_time < time() - 24 * 60 * 60) {
176 $ns =
$reset ?
'resetpassword' :
'changepassword';
verify($password, $hash)
Verify a password against a hash using a timing attack resistant approach.
elgg_get_site_entity($site_guid=0)
Get an entity (default is current site)
__construct()
Constructor.
reset_login_failure_count($user_guid)
Resets the fail login count for $user_guid.
executeNewPasswordReset($user_guid, $conf_code, $password=null)
Validate and change password for a user.
remove_private_setting($entity_guid, $name)
Deletes a private setting for an entity.
elgg_set_ignore_access($ignore=true)
Set if Elgg's access system should be ignored.
generateLegacyHash(\ElggUser $user, $password)
Hash a password for storage.
needsRehash($hash)
Determine if the password hash needs to be rehashed.
notify_user($to, $from, $subject, $message, array $params=array(), $methods_override="")
Notify a user via their preferences.
generate_random_cleartext_password()
Generate a random 12 character clear text password.
$user_guid
Avatar remove action.
generateHash($password)
Hash a password for storage using password_hash()
forcePasswordReset($user, $password)
Set a user's new password and save the entity.
sendNewPasswordRequest($user_guid)
Generate and send a password request email to a given user's registered email address.
get_entity($guid)
Loads and returns an entity object from a guid.