diff --git a/lib/Service/RecoveryEmailService.php b/lib/Service/RecoveryEmailService.php index 8ac6013a735f9a915f2da8ca0f06d3ae5fb95349..74a4f6194560df99b767d4e8b6933414831d3919 100644 --- a/lib/Service/RecoveryEmailService.php +++ b/lib/Service/RecoveryEmailService.php @@ -121,9 +121,6 @@ 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); @@ -158,6 +155,9 @@ 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");