aboutsummaryrefslogtreecommitdiff
path: root/app/Models/Auth.php
diff options
context:
space:
mode:
authorGravatar Alexandre Alapetite <alexandre@alapetite.fr> 2017-04-11 17:31:07 +0200
committerGravatar GitHub <noreply@github.com> 2017-04-11 17:31:07 +0200
commitaa75cebbfe3dd2a6f8d8c9f3dfe72091e8381376 (patch)
treecc0907d84ec5ad72baed8e0fb6fe7d81176bbb3c /app/Models/Auth.php
parente849de7296efbece490447cdceeed9726f10b33c (diff)
parent510045b3c554261a0a6434bfe73adac32b12cc81 (diff)
Merge pull request #1493 from Alkarex/multiuser-token
Multi-user token
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();