diff --git a/patches/002-login-without-domain.patch b/patches/002-login-without-domain.patch index 847c5635905d19ece282fc91d83c6c3a642a155f..b857597885783171c5730f6afd70ee736c6c4871 100644 --- a/patches/002-login-without-domain.patch +++ b/patches/002-login-without-domain.patch @@ -12,7 +12,7 @@ diff --git ./core/Controller/LoginController.php ./core/Controller/LoginControll @@ -303,6 +303,27 @@ return $this->generateRedirect($redirect_url); } - + + $user = trim($user); + $user = mb_strtolower($user, 'UTF-8'); + $domain = $this->config->getSystemValue('mail_domain', ''); @@ -37,13 +37,21 @@ diff --git ./core/Controller/LoginController.php ./core/Controller/LoginControll $data = new LoginData( $this->request, trim($user), ---- ./core/Controller/WebAuthnController.php 2022-05-11 11:11:55.469731468 +0530 -+++ ./core/Controller/WebAuthnController-new.php 2022-05-30 19:34:53.540848852 +0530 -@@ -73,6 +73,26 @@ - +--- ./core/Controller/WebAuthnController.php 2022-08-18 10:33:16.150199100 +0530 ++++ ./core/Controller/WebAuthnController-new.php 2022-08-18 10:34:31.880199100 +0530 +@@ -37,6 +37,7 @@ + use OCP\ISession; + use OCP\Util; + use Webauthn\PublicKeyCredentialRequestOptions; ++use OCP\IUserManager; + + class WebAuthnController extends Controller { + private const WEBAUTHN_LOGIN = 'webauthn_login'; +@@ -73,6 +74,25 @@ + $this->logger->debug('Converting login name to UID'); $uid = $loginName; -+ $uid = trim($uid); ++ $uid = trim($uid); + $uid = mb_strtolower($uid, 'UTF-8'); + $domain = \OC::$server->getConfig()->getSystemValue('mail_domain', ''); + $domain_suffix = !empty($domain) ? '@' . $domain : ''; @@ -59,14 +67,14 @@ diff --git ./core/Controller/LoginController.php ./core/Controller/LoginControll + $uid = str_replace($alt_domain_suffix, '', $uid); + } + -+ if(!$this->userManager->userExists($uid)) { ++ if(!\OC::$server->get(IUserManager::class)->userExists($uid)) { + $uid = $uid . $domain_suffix; + } -+ Util::emitHook( '\OCA\Files_Sharing\API\Server2Server', 'preLoginNameUsedAsUserName', + --- ./lib/private/User/Session.php 2022-08-10 15:39:33.131890282 +0530 +++ ./lib/private/User/Session-new.php 2022-08-10 15:48:23.236165783 +0530 @@ -438,7 +438,11 @@ @@ -74,11 +82,11 @@ diff --git ./core/Controller/LoginController.php ./core/Controller/LoginControll OC\Security\Bruteforce\Throttler $throttler) { $currentDelay = $throttler->sleepDelay($request->getRemoteAddress(), 'login'); - -+ ++ + $altDomain = $this->config->getSystemValue('alt_mail_domain', ''); + $altDomainSuffix = !empty($altDomain) ? '@' . $altDomain : ''; + $user = str_replace($altDomainSuffix, '', $user); -+ ++ if ($this->manager instanceof PublicEmitter) { $this->manager->emit('\OC\User', 'preLogin', [$user, $password]); }