From 5f898dcc5ee244e4adbd6aa83b607c844d432fb6 Mon Sep 17 00:00:00 2001 From: Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> Date: Sun, 26 Mar 2023 14:17:22 +0200 Subject: Modernize Constants and use new constant for string 'currentUser' (#5089) * Modernize Constants and use new constant 'currentUser' * Add FreshRSS_Context::currentUser() function and use * Add FreshRSS_Context::currentUser() function and use * Add FreshRSS_Context::currentUser() function and use * Add FreshRSS_Context::currentUser() function and use * Add FreshRSS_Context::currentUser() function and use * Update app/Controllers/userController.php * Update app/Controllers/userController.php * Update app/Controllers/userController.php * Update app/Models/Auth.php * Update p/api/greader.php * Update p/api/greader.php * Update p/api/greader.php * Update app/Models/Context.php * Update app/Models/LogDAO.php * Update lib/Minz/Log.php * Update p/api/greader.php * Update app/layout/header.phtml * Update app/views/helpers/export/articles.phtml * Update cli/do-install.php * Remarque's from Alkarex * Remarque's from Alkarex * Refactor using new Minz_User class * Consistent naming of public constants --------- Co-authored-by: Luc Co-authored-by: Alexandre Alapetite --- app/Models/Auth.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'app/Models/Auth.php') diff --git a/app/Models/Auth.php b/app/Models/Auth.php index 90fb128d4..65e761fb8 100644 --- a/app/Models/Auth.php +++ b/app/Models/Auth.php @@ -21,11 +21,11 @@ class FreshRSS_Auth { } self::$login_ok = Minz_Session::param('loginOk', false); - $current_user = Minz_Session::param('currentUser', ''); - if ($current_user == '') { + $current_user = Minz_User::name(); + if ($current_user === null) { $current_user = FreshRSS_Context::$system_conf->default_user; Minz_Session::_params([ - 'currentUser' => $current_user, + Minz_User::CURRENT_USER => $current_user, 'csrf' => false, ]); } @@ -58,7 +58,7 @@ class FreshRSS_Auth { if (isset($credentials[1])) { $current_user = trim($credentials[0]); Minz_Session::_params([ - 'currentUser' => $current_user, + Minz_User::CURRENT_USER => $current_user, 'passwordHash' => trim($credentials[1]), 'csrf' => false, ]); @@ -84,7 +84,7 @@ class FreshRSS_Auth { } if ($login_ok) { Minz_Session::_params([ - 'currentUser' => $current_user, + Minz_User::CURRENT_USER => $current_user, 'csrf' => false, ]); } @@ -112,7 +112,7 @@ class FreshRSS_Auth { self::$login_ok = Minz_Session::param('passwordHash') === FreshRSS_Context::$user_conf->passwordHash; break; case 'http_auth': - $current_user = Minz_Session::param('currentUser'); + $current_user = Minz_User::name(); self::$login_ok = strcasecmp($current_user, httpAuthUser()) === 0; break; case 'none': @@ -140,7 +140,7 @@ class FreshRSS_Auth { if (FreshRSS_Context::$user_conf == null) { return false; } - $currentUser = Minz_Session::param('currentUser'); + $currentUser = Minz_User::name(); $isAdmin = FreshRSS_Context::$user_conf->is_admin; $default_user = FreshRSS_Context::$system_conf->default_user; $ok = self::$login_ok; @@ -181,7 +181,7 @@ class FreshRSS_Auth { if ($username == '') { $username = FreshRSS_Context::$system_conf->default_user; } - Minz_Session::_param('currentUser', $username); + Minz_User::change($username); switch (FreshRSS_Context::$system_conf->auth_type) { case 'form': -- cgit v1.2.3