Refactor auth methods

Signed-off-by: Morris Jobke <hey@morrisjobke.de>
pull/4430/head
Jörn Friedrich Dreyer 8 years ago committed by Morris Jobke
parent 215573fe3c
commit fff6d6e3e8
No known key found for this signature in database
GPG Key ID: 9CE5ED29E7FCD38A
  1. 19
      lib/private/legacy/api.php
  2. 5
      lib/private/legacy/user.php

@ -332,25 +332,20 @@ class OC_API {
$userSession = \OC::$server->getUserSession();
$request = \OC::$server->getRequest();
try {
$loginSuccess = $userSession->tryTokenLogin($request);
if (!$loginSuccess) {
$loginSuccess = $userSession->tryBasicAuthLogin($request, \OC::$server->getBruteForceThrottler());
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;
}
/**

@ -199,9 +199,10 @@ class OC_User {
if($setUidAsDisplayName) {
self::setDisplayName($uid);
}
self::getUserSession()->setLoginName($uid);
$userSession = self::getUserSession();
$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

Loading…
Cancel
Save