From 9c3e2ed1b4c95f7b355b41af120099e57d077882 Mon Sep 17 00:00:00 2001 From: Avinash Gusain Date: Tue, 21 Jan 2025 19:52:35 +0530 Subject: [PATCH] fix email empty --- lib/Service/RecoveryEmailService.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/Service/RecoveryEmailService.php b/lib/Service/RecoveryEmailService.php index 74a4f61..7ca523d 100644 --- a/lib/Service/RecoveryEmailService.php +++ b/lib/Service/RecoveryEmailService.php @@ -121,6 +121,9 @@ class RecoveryEmailService { return true; } public function validateRecoveryEmail(string $recoveryEmail, string $username = '', string $language = 'en'): bool { + if (empty($recoveryEmail)) { + return true; + } // Fetch user email if username is provided $email = $this->getUserEmail($username); @@ -155,10 +158,6 @@ class RecoveryEmailService { } private function enforceBasicRecoveryEmailRules(string $recoveryEmail, string $username, string $email, IL10N $l): void { - if (empty($recoveryEmail)) { - return; - } - if (!$this->isValidEmailFormat($recoveryEmail)) { $this->logger->info("User $username's requested recovery email does not match email format"); throw new InvalidRecoveryEmailException($l->t('Invalid Recovery Email')); -- GitLab