summaryrefslogtreecommitdiff
path: root/app/Models/Auth.php
diff options
context:
space:
mode:
authorGravatar Luc SANCHEZ <4697568+ColonelMoutarde@users.noreply.github.com> 2023-03-26 14:17:22 +0200
committerGravatar GitHub <noreply@github.com> 2023-03-26 14:17:22 +0200
commit5f898dcc5ee244e4adbd6aa83b607c844d432fb6 (patch)
tree3511bcb3f78d053f4488e70000ab55fee7bb688a /app/Models/Auth.php
parentdf24fa2207f56909084c613495b6f235b351c640 (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/Models/Auth.php')
-rw-r--r--app/Models/Auth.php16
1 files changed, 8 insertions, 8 deletions
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':