diff --git a/lib/Service/RecoveryEmailService.php b/lib/Service/RecoveryEmailService.php index 74a4f6194560df99b767d4e8b6933414831d3919..7ca523d5f1f0360e5c2b28aa5280a7196b34136b 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'));