diff options
| author | 2023-03-26 14:17:22 +0200 | |
|---|---|---|
| committer | 2023-03-26 14:17:22 +0200 | |
| commit | 5f898dcc5ee244e4adbd6aa83b607c844d432fb6 (patch) | |
| tree | 3511bcb3f78d053f4488e70000ab55fee7bb688a /app/Controllers | |
| parent | df24fa2207f56909084c613495b6f235b351c640 (diff) | |
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 <sanchezluc+freshrss@gmail.com>
Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Diffstat (limited to 'app/Controllers')
| -rw-r--r-- | app/Controllers/apiController.php | 2 | ||||
| -rw-r--r-- | app/Controllers/authController.php | 6 | ||||
| -rw-r--r-- | app/Controllers/importExportController.php | 2 | ||||
| -rw-r--r-- | app/Controllers/userController.php | 10 |
4 files changed, 10 insertions, 10 deletions
diff --git a/app/Controllers/apiController.php b/app/Controllers/apiController.php index ba3f76869..53ae2858c 100644 --- a/app/Controllers/apiController.php +++ b/app/Controllers/apiController.php @@ -11,7 +11,7 @@ class FreshRSS_api_Controller extends FreshRSS_ActionController { * @return false|string */ public static function updatePassword(string $apiPasswordPlain) { - $username = Minz_Session::param('currentUser'); + $username = Minz_User::name(); $userConfig = FreshRSS_Context::$user_conf; $apiPasswordHash = FreshRSS_password_Util::hash($apiPasswordPlain); diff --git a/app/Controllers/authController.php b/app/Controllers/authController.php index 03e223375..30fd705f5 100644 --- a/app/Controllers/authController.php +++ b/app/Controllers/authController.php @@ -72,7 +72,7 @@ class FreshRSS_auth_Controller extends FreshRSS_ActionController { } $auth_type = FreshRSS_Context::$system_conf->auth_type; - FreshRSS_Context::initUser('_', false); + FreshRSS_Context::initUser(Minz_User::INTERNAL_USER, false); switch ($auth_type) { case 'form': Minz_Request::forward(array('c' => 'auth', 'a' => 'formLogin')); @@ -145,7 +145,7 @@ class FreshRSS_auth_Controller extends FreshRSS_ActionController { if ($ok) { // Set session parameter to give access to the user. Minz_Session::_params([ - 'currentUser' => $username, + Minz_User::CURRENT_USER => $username, 'passwordHash' => FreshRSS_Context::$user_conf->passwordHash, 'csrf' => false, ]); @@ -195,7 +195,7 @@ class FreshRSS_auth_Controller extends FreshRSS_ActionController { unset($password); if ($ok) { Minz_Session::_params([ - 'currentUser' => $username, + Minz_User::CURRENT_USER => $username, 'passwordHash' => $s, 'csrf' => false, ]); diff --git a/app/Controllers/importExportController.php b/app/Controllers/importExportController.php index 5066ff124..14adc793d 100644 --- a/app/Controllers/importExportController.php +++ b/app/Controllers/importExportController.php @@ -586,7 +586,7 @@ class FreshRSS_importExport_Controller extends FreshRSS_ActionController { ); } - $username = Minz_Session::param('currentUser'); + $username = Minz_User::name(); $export_service = new FreshRSS_Export_Service($username); $export_opml = Minz_Request::param('export_opml', false); 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); |
