From aab20d9139af6d0ce5b1184b466fb184387eb710 Mon Sep 17 00:00:00 2001 From: hahn <axel.hahn@iml.unibe.ch> Date: Wed, 17 Jun 2020 18:00:34 +0200 Subject: [PATCH] task#3875 - fix user login --- public_html/deployment/classes/user.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/public_html/deployment/classes/user.class.php b/public_html/deployment/classes/user.class.php index 756b6ae9..e8d0afe6 100644 --- a/public_html/deployment/classes/user.class.php +++ b/public_html/deployment/classes/user.class.php @@ -137,7 +137,7 @@ class user { */ public function authenticate(){ global $aConfig, $aParams; - print_r($aConfig); + //print_r($aConfig); if(!array_key_exists('auth', $aConfig) || !count($aConfig['auth']) || !array_key_exists('user', $aParams)){ return false; } @@ -161,8 +161,8 @@ class user { if ($oUserAuth && $oUserAuth->authenticate($sUser, $sPassword)){ // set a session - it must correspondent with _autoDetectUser() - $_SESSION["PHP_AUTH_USER"]=$sUser; - $this->setUser(''); + // $_SESSION["PHP_AUTH_USER"]=$sUser; + $this->setUser($sUser); return true; } } @@ -181,12 +181,14 @@ class user { /** * set an authenticated user and get its roles + * @param string $sUser optional: set a given username */ public function setUser($sUser=false){ if($sUser!==false){ $this->_sUsername=$sUser; $_SESSION["PHP_AUTH_USER"]=$sUser; } else { + // check user from basic auth or cli $this->_sUsername=$this->_autoDetectUser(); } $this->_getUserGroups(); -- GitLab