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

Commit 540d3587 authored by AVINASH GUSAIN's avatar AVINASH GUSAIN
Browse files

patch added for get by email

parent f70da530
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -168,6 +168,7 @@ RUN cd ${BASE_DIR}/custom_apps && patch -p0 < ${TMP_PATCH_DIR}/005-autocomplete-
RUN cd ${BASE_DIR} && patch -u ${BASE_DIR}/apps/dashboard/lib/Controller/DashboardController.php -i ${TMP_PATCH_DIR}/012-remove-user-status-widget.patch
RUN patch -u ${BASE_DIR}/core/templates/layout.guest.php -i ${TMP_PATCH_DIR}/016-login-screen.patch
RUN patch -u ${BASE_DIR}/lib/private/Notification/Manager.php -i ${TMP_PATCH_DIR}/020-fairuse-notification-fix.patch
RUN patch -u ${BASE_DIR}/lib/private/User/Manager.php -i ${TMP_PATCH_DIR}/023-patch_getbyemail.patch
RUN rm -rf ${TMP_PATCH_DIR}

RUN curl -fsSL -o ldap_write_support.tar.gz \
+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 {