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

Commit 5cc43caa authored by Ronak Patel's avatar Ronak Patel
Browse files

added empty condition at top

parent 5bed7368
Loading
Loading
Loading
Loading
Loading
+17 −16
Original line number Diff line number Diff line
@@ -65,7 +65,7 @@ class RecoveryEmailService {
	public function validateRecoveryEmail(string $username, string $recoveryEmail) : bool {
		$user = $this->userManager->get($username);
		$email = $user->getEMailAddress();

		if (!empty($recoveryEmail)) {
			if (!filter_var($recoveryEmail, FILTER_VALIDATE_EMAIL)) {
				$this->logger->info("User  $username's requested recovery email does not match email format");
				throw new InvalidRecoveryEmailException();
@@ -74,14 +74,15 @@ class RecoveryEmailService {
				$this->logger->info("User ID $username's requested recovery email is the same as email");
				throw new SameRecoveryEmailAsEmailException();
			}
		if (!empty($recoveryEmail) && $this->isRecoveryEmailTaken($username, $recoveryEmail)) {
			if ($this->isRecoveryEmailTaken($username, $recoveryEmail)) {
				$this->logger->info("User ID $username's requested recovery email address is already taken");
				throw new RecoveryEmailAlreadyFoundException();
			}
		if (!empty($recoveryEmail) && $this->isRecoveryEmailDomainDisallowed($recoveryEmail)) {
			if ($this->isRecoveryEmailDomainDisallowed($recoveryEmail)) {
				$this->logger->info("User ID $username's requested recovery email address is disallowed.");
				throw new MurenaDomainDisallowedException();
			}
		}
		return true;
	}
	public function isRecoveryEmailDomainDisallowed(string $recoveryEmail): bool {