From 7d83321286efc37162521f4302cf17f03c317020 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Sat, 14 Aug 2021 12:22:42 +0200 Subject: Better catch when a user does not exists (#3751) #fix https://github.com/FreshRSS/FreshRSS/issues/3735 Before, we were relying on an exception during the first stages of user initalisation. Now the check is explicit and cleaner, producing a more appropriate HTTP response for the API. --- cli/_cli.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'cli/_cli.php') diff --git a/cli/_cli.php b/cli/_cli.php index ed884bbb6..10a92385a 100644 --- a/cli/_cli.php +++ b/cli/_cli.php @@ -28,8 +28,7 @@ function cliInitUser($username) { fail('FreshRSS error: invalid username: ' . $username . "\n"); } - $usernames = listUsers(); - if (!in_array($username, $usernames)) { + if (!FreshRSS_user_Controller::userExists($username)) { fail('FreshRSS error: user not found: ' . $username . "\n"); } -- cgit v1.2.3