Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 9 additions & 12 deletions lib/private/legacy/api.php
Original file line number Diff line number Diff line change
Expand Up @@ -332,25 +332,22 @@ private static function loginUser() {
$userSession = \OC::$server->getUserSession();
$request = \OC::$server->getRequest();
try {
$loginSuccess = $userSession->tryTokenLogin($request);
if (!$loginSuccess) {
$loginSuccess = $userSession->tryBasicAuthLogin($request, \OC::$server->getBruteForceThrottler());
if (OC_User::handleApacheAuth()) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This handleApacheAuth() was basically added here.

self::$logoutRequired = false;
} else if ($userSession->tryTokenLogin($request)
|| $userSession->tryBasicAuthLogin($request, \OC::$server->getBruteForceThrottler())) {
self::$logoutRequired = true;
} else {
return false;
}
} catch (\OC\User\LoginException $e) {
return false;
}

if ($loginSuccess === true) {
self::$logoutRequired = true;

// initialize the user's filesystem
\OC_Util::setupFS(\OC_User::getUser());
self::$isLoggedIn = true;

return \OC_User::getUser();
} catch (\OC\User\LoginException $e) {
return false;
}

return false;
}

/**
Expand Down
6 changes: 4 additions & 2 deletions lib/private/legacy/user.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,11 @@ public static function loginWithApache(\OCP\Authentication\IApacheBackend $backe
if($setUidAsDisplayName) {
self::setDisplayName($uid);
}
self::getUserSession()->setLoginName($uid);
$userSession = self::getUserSession();
$userSession->getSession()->regenerateId();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the only changed line here.

$userSession->setLoginName($uid);
$request = OC::$server->getRequest();
self::getUserSession()->createSessionToken($request, $uid, $uid);
$userSession->createSessionToken($request, $uid, $uid);
// setup the filesystem
OC_Util::setupFS($uid);
// first call the post_login hooks, the login-process needs to be
Expand Down