From 05165a44a6c0d3b2083803886f3f96ad305bdbc6 Mon Sep 17 00:00:00 2001 From: Marco Date: Wed, 21 Mar 2018 02:54:50 +0100 Subject: [PATCH] Implement method 'changePasswordForUserById' in class 'Administration' --- src/Administration.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/Administration.php b/src/Administration.php index f94933c..06f8999 100644 --- a/src/Administration.php +++ b/src/Administration.php @@ -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 *