aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Auth.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-06-03 15:18:04 +0200
committerGravatar GitHub <noreply@github.com> 2017-06-03 15:18:04 +0200
commitfd43ee546e419fc9fbb9a3ad974d2234d94cffaa (patch)
tree2df9fd1daf5b994d7bbde8dd46f7605e4370c268 /app/Models/Auth.php
parentbe0bcfef7e38f27284ec7b377b342ba389515964 (diff)
parent6f3653d430c86b026f8e007a276fdba2b09b61b3 (diff)
Merge pull request #1549 from FreshRSS/dev1.7.0
Version 1.7.0
Diffstat (limited to 'app/Models/Auth.php')
-rw-r--r--app/Models/Auth.php27
1 files changed, 23 insertions, 4 deletions
diff --git a/app/Models/Auth.php b/app/Models/Auth.php
index 476627e10..4de058999 100644
--- a/app/Models/Auth.php
+++ b/app/Models/Auth.php
@@ -74,6 +74,10 @@ class FreshRSS_Auth {
public static function giveAccess() {
$current_user = Minz_Session::param('currentUser');
$user_conf = get_user_configuration($current_user);
+ if ($user_conf == null) {
+ self::$login_ok = false;
+ return;
+ }
$system_conf = Minz_Configuration::get('system');
switch ($system_conf->auth_type) {
@@ -120,13 +124,28 @@ class FreshRSS_Auth {
* Removes all accesses for the current user.
*/
public static function removeAccess() {
- Minz_Session::_param('loginOk');
self::$login_ok = false;
- $conf = Minz_Configuration::get('system');
- Minz_Session::_param('currentUser', $conf->default_user);
+ Minz_Session::_param('loginOk');
Minz_Session::_param('csrf');
+ $system_conf = Minz_Configuration::get('system');
- switch ($conf->auth_type) {
+ $username = '';
+ $token_param = Minz_Request::param('token', '');
+ if ($token_param != '') {
+ $username = trim(Minz_Request::param('user', ''));
+ if ($username != '') {
+ $conf = get_user_configuration($username);
+ if ($conf == null) {
+ $username = '';
+ }
+ }
+ }
+ if ($username == '') {
+ $username = $system_conf->default_user;
+ }
+ Minz_Session::_param('currentUser', $username);
+
+ switch ($system_conf->auth_type) {
case 'form':
Minz_Session::_param('passwordHash');
FreshRSS_FormAuth::deleteCookie();