mirror of
https://github.com/delight-im/PHP-Auth.git
synced 2025-08-05 15:47:25 +02:00
Implement method 'changePasswordForUserById' in class 'Administration'
This commit is contained in:
@@ -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
|
* Changes the password for the user with the given username
|
||||||
*
|
*
|
||||||
|
Reference in New Issue
Block a user