Loading patches/023-patch_getbyemail.patch 0 → 100644 +29 −0 Original line number Diff line number Diff line --- lib/private/User/Manager.php 2023-02-03 17:18:44.729561986 +0530 +++ lib/private/User/Manager-new.php 2023-02-03 17:20:18.929562546 +0530 @@ -705,16 +705,18 @@ * @since 9.1.0 */ public function getByEmail($email) { - // looking for 'email' only (and not primary_mail) is intentional - $userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email); + $uid=$email; // get first part of email if it contains alt domain, otherwise it is just $email + $alt_domain = $this->config->getSystemValue('alt_mail_domain', ''); + $alt_domain_suffix = !empty($alt_domain) ? '@' . $alt_domain : ''; - $users = array_map(function ($uid) { - return $this->get($uid); - }, $userIds); + if (stristr($email, $alt_domain_suffix) !== FALSE) { + $uid = str_replace($alt_domain_suffix, '', $email); + } - return array_values(array_filter($users, function ($u) { - return ($u instanceof IUser); - })); + if($this->get($uid)) { + return([$this->get($uid)]); + } + return []; } private function verifyUid(string $uid): bool { Loading
patches/023-patch_getbyemail.patch 0 → 100644 +29 −0 Original line number Diff line number Diff line --- lib/private/User/Manager.php 2023-02-03 17:18:44.729561986 +0530 +++ lib/private/User/Manager-new.php 2023-02-03 17:20:18.929562546 +0530 @@ -705,16 +705,18 @@ * @since 9.1.0 */ public function getByEmail($email) { - // looking for 'email' only (and not primary_mail) is intentional - $userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email); + $uid=$email; // get first part of email if it contains alt domain, otherwise it is just $email + $alt_domain = $this->config->getSystemValue('alt_mail_domain', ''); + $alt_domain_suffix = !empty($alt_domain) ? '@' . $alt_domain : ''; - $users = array_map(function ($uid) { - return $this->get($uid); - }, $userIds); + if (stristr($email, $alt_domain_suffix) !== FALSE) { + $uid = str_replace($alt_domain_suffix, '', $email); + } - return array_values(array_filter($users, function ($u) { - return ($u instanceof IUser); - })); + if($this->get($uid)) { + return([$this->get($uid)]); + } + return []; } private function verifyUid(string $uid): bool {