Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d76ea13 authored by Akhil's avatar Akhil 🙂
Browse files

fix: use userExists instead of domain equality

parent 0edf0e64
Loading
Loading
Loading
Loading
Loading
+3 −5
Original line number Diff line number Diff line
@@ -80,18 +80,16 @@ diff --git ./core/Controller/LoginController.php ./core/Controller/LoginControll

--- ./lib/private/User/Session.php	2026-03-23 17:46:39.585001447 +0600
+++ ./lib/private/User/Session-new.php	2026-03-23 17:59:52.577453313 +0600
@@ -384,6 +384,14 @@
@@ -384,6 +384,12 @@
 		$remoteAddress = $request->getRemoteAddress();
 		$currentDelay = $throttler->sleepDelayOrThrowOnMax($remoteAddress, 'login');
 
+		$mainDomain = $this->config->getSystemValue('main_domain', '');
+		$legacyDomain = $this->config->getSystemValue('legacy_domain', '');
+		$mainDomainSuffix = !empty($mainDomain) ? '@' . $mainDomain : '';
+		// Don't replace legacy domain in login name
+		if ($mainDomain !== $legacyDomain) {
+		// If user with given UID exists, we don't want to replace the domain
+		if (!$this->manager->userExists($user)) {
+			$user = str_replace($mainDomainSuffix, '', $user);
+		}
+
 		if ($this->manager instanceof PublicEmitter) {
 			$this->manager->emit('\OC\User', 'preLogin', [$user, $password]);
 		}