we first shall check if the current session is valid - otherwise the session-id will be regenerated on login via basic auth
This commit is contained in:
parent
3eb58d9973
commit
0d90b90d94
1 changed files with 13 additions and 12 deletions
|
@ -270,6 +270,18 @@ class OC_API {
|
|||
* @return string|false (username, or false on failure)
|
||||
*/
|
||||
private static function loginUser(){
|
||||
|
||||
// reuse existing login
|
||||
$loggedIn = OC_User::isLoggedIn();
|
||||
$ocsApiRequest = isset($_SERVER['HTTP_OCS_APIREQUEST']) ? $_SERVER['HTTP_OCS_APIREQUEST'] === 'true' : false;
|
||||
if ($loggedIn === true && $ocsApiRequest) {
|
||||
|
||||
// initialize the user's filesystem
|
||||
\OC_Util::setUpFS(\OC_User::getUser());
|
||||
|
||||
return OC_User::getUser();
|
||||
}
|
||||
|
||||
// basic auth
|
||||
$authUser = isset($_SERVER['PHP_AUTH_USER']) ? $_SERVER['PHP_AUTH_USER'] : '';
|
||||
$authPw = isset($_SERVER['PHP_AUTH_PW']) ? $_SERVER['PHP_AUTH_PW'] : '';
|
||||
|
@ -283,17 +295,6 @@ class OC_API {
|
|||
return $authUser;
|
||||
}
|
||||
|
||||
// reuse existing login
|
||||
$loggedIn = OC_User::isLoggedIn();
|
||||
$ocsApiRequest = isset($_SERVER['HTTP_OCS_APIREQUEST']) ? $_SERVER['HTTP_OCS_APIREQUEST'] === 'true' : false;
|
||||
if ($loggedIn === true && $ocsApiRequest) {
|
||||
|
||||
// initialize the user's filesystem
|
||||
\OC_Util::setUpFS(\OC_User::getUser());
|
||||
|
||||
return OC_User::getUser();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue