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/Controllers/userController.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'app/Controllers/userController.php') diff --git a/app/Controllers/userController.php b/app/Controllers/userController.php index 01656099c..89489e590 100644 --- a/app/Controllers/userController.php +++ b/app/Controllers/userController.php @@ -68,7 +68,7 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController { )); if ($ok) { - $isSelfUpdate = Minz_Session::param('currentUser', '_') === $username; + $isSelfUpdate = Minz_User::name() === $username; if ($passwordPlain == '' || !$isSelfUpdate) { Minz_Request::good(_t('feedback.user.updated', $username), array('c' => 'user', 'a' => 'manage')); } else { @@ -124,7 +124,7 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController { } $ok = self::updateUser( - Minz_Session::param('currentUser'), + Minz_User::name(), $email, $passwordPlain, array( @@ -359,7 +359,7 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController { if ($ok && !FreshRSS_Auth::hasAccess('admin')) { $user_conf = get_user_configuration($new_user_name); Minz_Session::_params([ - 'currentUser' => $new_user_name, + Minz_User::CURRENT_USER => $new_user_name, 'passwordHash' => $user_conf->passwordHash, 'csrf' => false, ]); @@ -487,7 +487,7 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController { Minz_Error::error(404); } - $username = Minz_Session::param('currentUser', '_'); + $username = Minz_User::name(); $user_config = FreshRSS_Context::$user_conf; if ($user_config->email_validation_token === '') { @@ -524,7 +524,7 @@ class FreshRSS_user_Controller extends FreshRSS_ActionController { */ public function deleteAction() { $username = Minz_Request::param('username'); - $self_deletion = Minz_Session::param('currentUser', '_') === $username; + $self_deletion = Minz_User::name() === $username; if (!FreshRSS_Auth::hasAccess('admin') && !$self_deletion) { Minz_Error::error(403); -- cgit v1.2.3