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

Commit b5fe8536 authored by Akhil's avatar Akhil 🙂 Committed by Arnau Vàzquez
Browse files

Fix recovery email patch

parent 3a6672fb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@ ARG ECLOUD_LAUNCHER_JOB_ID="308979"
ARG GOOGLE_INTEGRATION_VERSION="1.0.6"
ARG LDAP_WRITE_SUPPORT_VERSION="1.4.0"

RUN sed -i 's/22,2,8,1/22,2,8,10/' ${BASE_DIR}/version.php
RUN sed -i 's/22,2,8,1/22,2,8,11/' ${BASE_DIR}/version.php
COPY custom_entrypoint.sh /
RUN chmod +x /custom_entrypoint.sh
RUN mkdir -p /var/www/skeleton/Documents && mkdir -p /var/www/skeleton/Images
+10 −7
Original line number Diff line number Diff line
--- ./core/Controller/LostController.php	2022-05-27 14:46:14.400838300 +0530
+++ .//core/Controller/LostController-new.php	2022-05-27 14:46:16.710838300 +0530
@@ -174,6 +174,20 @@
--- ./core/Controller/LostController.php	2022-05-25 15:07:44.582984541 +0530
+++ ./core/Controller/LostController-new.php	2022-05-28 15:29:43.418394746 +0530
@@ -174,8 +174,23 @@
 	 */
 	protected function checkPasswordResetToken(string $token, string $userId): void {
 		try {
@@ -8,7 +8,6 @@
+			$domainSuffix = !empty($domain) ? '@' . $domain : '';
+			$altDomain = $this->config->getSystemValue('alt_mail_domain', '');
+			$altDomainSuffix = !empty($altDomain) ? '@' . $altDomain : '';
+
+			if(stristr($userId, $domainSuffix) !== FALSE) {
+				$userId = str_replace($domainSuffix, '', $userId);
+			}
@@ -19,9 +18,14 @@
+				$userId = $userId . $domainSuffix;
+			}
 			$user = $this->userManager->get($userId);
 			$this->verificationToken->check($token, $user, 'lostpassword', $user ? $user->getEMailAddress() : '', true);
-			$this->verificationToken->check($token, $user, 'lostpassword', $user ? $user->getEMailAddress() : '', true);
+			$recoveryEmail = $this->config->getUserValue($userId, 'email-recovery', 'recovery-email');
+			$mailAddress = is_null($recoveryEmail) ? '' : $recoveryEmail;
+			$this->verificationToken->check($token, $user, 'lostpassword', $mailAddress, true);
 		} catch (InvalidTokenException $e) {
@@ -287,8 +301,22 @@
 			$error = $e->getCode() === InvalidTokenException::TOKEN_EXPIRED
 				? $this->l10n->t('Could not reset password because the token is expired')
@@ -287,8 +302,21 @@
 	 * @throws \OCP\PreConditionNotMetException
 	 */
 	protected function sendEmail($input) {
@@ -38,7 +42,6 @@
+		if(!$this->userManager->userExists($input) ) {
+			$input = $input . $domainSuffix;
+		}
+
 		$user = $this->findUserByIdOrMail($input);
-		$email = $user->getEMailAddress();
+		$email = $this->config->getUserValue($user->getUID(), 'email-recovery', 'recovery-email');