aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Auth.php
diff options
context:
space:
mode:
Diffstat (limited to 'app/Models/Auth.php')
-rw-r--r--app/Models/Auth.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/app/Models/Auth.php b/app/Models/Auth.php
index 513a9cb2f..6d079a01f 100644
--- a/app/Models/Auth.php
+++ b/app/Models/Auth.php
@@ -13,7 +13,7 @@ class FreshRSS_Auth {
* This method initializes authentication system.
*/
public static function init() {
- if (Minz_Session::param('REMOTE_USER', '') !== httpAuthUser()) {
+ if (isset($_SESSION['REMOTE_USER']) && $_SESSION['REMOTE_USER'] !== httpAuthUser()) {
//HTTP REMOTE_USER has changed
self::removeAccess();
}
@@ -24,6 +24,7 @@ class FreshRSS_Auth {
$conf = Minz_Configuration::get('system');
$current_user = $conf->default_user;
Minz_Session::_param('currentUser', $current_user);
+ Minz_Session::_param('csrf');
}
if (self::$login_ok) {
@@ -56,6 +57,7 @@ class FreshRSS_Auth {
$current_user = trim($credentials[0]);
Minz_Session::_param('currentUser', $current_user);
Minz_Session::_param('passwordHash', trim($credentials[1]));
+ Minz_Session::_param('csrf');
}
return $current_user != '';
case 'http_auth':
@@ -63,6 +65,7 @@ class FreshRSS_Auth {
$login_ok = $current_user != '' && FreshRSS_UserDAO::exists($current_user);
if ($login_ok) {
Minz_Session::_param('currentUser', $current_user);
+ Minz_Session::_param('csrf');
}
return $login_ok;
case 'none':
@@ -196,13 +199,10 @@ class FreshRSS_Auth {
}
public static function isCsrfOk($token = null) {
$csrf = Minz_Session::param('csrf');
- if ($csrf == '') {
- return true; //Not logged in yet
- }
if ($token === null) {
$token = Minz_Request::fetchPOST('_csrf');
}
- return $token === $csrf;
+ return $token != '' && $token === $csrf;
}
}