diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php index 7b959a0d89..27900cc1ca 100644 --- a/apps/dav/lib/Connector/Sabre/Auth.php +++ b/apps/dav/lib/Connector/Sabre/Auth.php @@ -110,10 +110,10 @@ class Auth extends AbstractBasic { $this->session->close(); return true; } else { - \OC_Util::setUpFS(); //login hooks may need early access to the filesystem + \OC_Util::setupFS(); //login hooks may need early access to the filesystem if($this->userSession->logClientIn($username, $password)) { $this->userSession->createSessionToken($this->request, $this->userSession->getUser()->getUID(), $username, $password); - \OC_Util::setUpFS($this->userSession->getUser()->getUID()); + \OC_Util::setupFS($this->userSession->getUser()->getUID()); $this->session->set(self::DAV_AUTHENTICATED, $this->userSession->getUser()->getUID()); $this->session->close(); return true; diff --git a/lib/private/User/Session.php b/lib/private/User/Session.php index e1ede95e2a..f560bb4bfc 100644 --- a/lib/private/User/Session.php +++ b/lib/private/User/Session.php @@ -361,7 +361,14 @@ class Session implements IUserSession, Emitter { // TODO: throw LoginException instead (https://github.com/owncloud/core/pull/24616) return false; } - return $this->login($user, $password); + if (!$this->login($user, $password) ) { + $users = $this->manager->getByEmail($user); + if (count($users) === 1) { + return $this->login($users[0]->getUID(), $password); + } + return false; + } + return true; } private function isTokenAuthEnforced() { @@ -376,7 +383,11 @@ class Session implements IUserSession, Emitter { ); $user = $this->manager->get($username); if (is_null($user)) { - return true; + $users = $this->manager->getByEmail($username); + if (count($users) !== 1) { + return true; + } + $user = $users[0]; } // DI not possible due to cyclic dependencies :'-/ return OC::$server->getTwoFactorAuthManager()->isTwoFactorAuthenticated($user); @@ -385,7 +396,7 @@ class Session implements IUserSession, Emitter { /** * Check if the given 'password' is actually a device token * - * @param type $password + * @param string $password * @return boolean */ public function isTokenPassword($password) { diff --git a/lib/private/legacy/api.php b/lib/private/legacy/api.php index 1e581153ce..024f3c0fb6 100644 --- a/lib/private/legacy/api.php +++ b/lib/private/legacy/api.php @@ -349,7 +349,7 @@ class OC_API { if ($ocsApiRequest) { // initialize the user's filesystem - \OC_Util::setUpFS(\OC_User::getUser()); + \OC_Util::setupFS(\OC_User::getUser()); self::$isLoggedIn = true; return OC_User::getUser(); @@ -374,7 +374,7 @@ class OC_API { self::$logoutRequired = true; // initialize the user's filesystem - \OC_Util::setUpFS(\OC_User::getUser()); + \OC_Util::setupFS(\OC_User::getUser()); self::$isLoggedIn = true; return \OC_User::getUser();