Allow login by email address via webdav as well - fixes #24791
This commit is contained in:
parent
6de406ae51
commit
f20c617154
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in New Issue