aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/userController.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2021-08-14 12:22:42 +0200
committerGravatar GitHub <noreply@github.com> 2021-08-14 12:22:42 +0200
commit7d83321286efc37162521f4302cf17f03c317020 (patch)
tree4306a63572b04de0bc94e4ced0fff3d0c23866ed /app/Controllers/userController.php
parent92ae9c89a4356abc94f2ec5c96a1b783f933fb18 (diff)
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.
Diffstat (limited to 'app/Controllers/userController.php')
-rw-r--r--app/Controllers/userController.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php
index 0b23ff953..81f8b20a8 100644
--- a/app/Controllers/userController.php
+++ b/app/Controllers/userController.php
@@ -14,6 +14,10 @@ class FreshRSS_user_Controller extends Minz_ActionController {
return preg_match('/^' . self::USERNAME_PATTERN . '$/', $username) === 1;
}
+ public static function userExists($username) {
+ return @file_exists(USERS_PATH . '/' . $username . '/config.php');
+ }
+
public static function updateUser($user, $email, $passwordPlain, $userConfigUpdated = array()) {
$userConfig = get_user_configuration($user);
if ($userConfig === null) {