summaryrefslogtreecommitdiff
path: root/app/Models/Auth.php
diff options
context:
space:
mode:
authorGravatar Seokseong Jeon <sjeon87+github@gmail.com> 2017-05-05 01:43:34 +0900
committerGravatar GitHub <noreply@github.com> 2017-05-05 01:43:34 +0900
commitcb897980cd930ec73762118ca8e38ec0050ff5e3 (patch)
tree37ae732b80e856987739a6409c06cf6da66c95d0 /app/Models/Auth.php
parent09787cfd7a68e994f248c0cad0ebe5ae68b7aaf3 (diff)
parent53f00571e554f6eeea4fea19d9ddc5eca2ce2997 (diff)
Merge branch 'dev' into cli-act-num-articles
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();