1
0
mirror of https://github.com/delight-im/PHP-Auth.git synced 2025-08-04 23:27:28 +02:00

Implement method 'changePasswordForUserById' in class 'Administration'

This commit is contained in:
Marco
2018-03-21 02:54:50 +01:00
parent c3f2097750
commit 05165a44a6

View File

@@ -369,6 +369,27 @@ final class Administration extends UserManager {
}
}
/**
* Changes the password for the user with the given ID
*
* @param int $userId the ID of the user whose password to change
* @param string $newPassword the new password to set
* @throws UnknownIdException if no user with the specified ID has been found
* @throws InvalidPasswordException if the desired new password has been invalid
* @throws AuthError if an internal problem occurred (do *not* catch)
*/
public function changePasswordForUserById($userId, $newPassword) {
$userId = (int) $userId;
$newPassword = self::validatePassword($newPassword);
$this->updatePasswordInternal(
$userId,
$newPassword
);
$this->deleteRememberDirectiveForUserById($userId);
}
/**
* Changes the password for the user with the given username
*