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

Commit 5838c888 authored by AVINASH GUSAIN's avatar AVINASH GUSAIN
Browse files

old code added back

parent dcd950b8
Loading
Loading
Loading
Loading
Loading
+10 −18
Original line number Original line Diff line number Diff line
--- lib/private/User/Manager.php	2023-02-03 17:18:44.729561986 +0530
--- 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
+++ lib/private/User/Manager-new.php	2023-02-03 18:00:50.509563655 +0530
@@ -705,16 +705,18 @@
@@ -705,6 +705,18 @@
 	 * @since 9.1.0
 	 * @since 9.1.0
 	 */
 	 */
 	public function getByEmail($email) {
 	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
+		$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 = $this->config->getSystemValue('alt_mail_domain', '');
+		$alt_domain_suffix = !empty($alt_domain) ? '@'  . $alt_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) {
+		if (stristr($email, $alt_domain_suffix) !== FALSE) {
+				$uid = str_replace($alt_domain_suffix, '', $email);
+				$uid = str_replace($alt_domain_suffix, '', $email);
+		}
+		}
 
+
-		return array_values(array_filter($users, function ($u) {
-			return ($u instanceof IUser);
-		}));
+		if ($this->get($uid)) {
+		if ($this->get($uid)) {
+			return([$this->get($uid)]);
+			return([$this->get($uid)]);
+		}
+		}
+		  return [];
+
 	}
 		// looking for 'email' only (and not primary_mail) is intentional
 		$userIds = $this->config->getUsersForUserValueCaseInsensitive('settings', 'email', $email);
 	private function verifyUid(string $uid): bool {