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

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

added new function

parent 5402fc07
Loading
Loading
Loading
Loading
Loading
+20 −10
Original line number Diff line number Diff line
@@ -247,6 +247,19 @@ class UserService {
			throw new Exception("Username is already taken.");
		}
		if (!empty($recoveryEmail)) {
			$this->validateRecoveryEmail($recoveryEmail);
		}
		return $this->addNewUserToLDAP($displayname, $recoveryEmail, $username, $userEmail, $password);
		
	}
	/**
	 * Validates the recovery email address.
	 *
	 * @param string $recoveryEmail The recovery email address to be validated.
	 * @throws Exception If the recovery email address has an incorrect format, is already taken, or if the domain is disallowed.
	 * @return void
	 */
	public function validateRecoveryEmail(string $recoveryEmail): void {
		if (!$this->isValidEmailFormat($recoveryEmail)) {
			throw new Exception('Recovery email address has an incorrect format.');
		}
@@ -257,9 +270,6 @@ class UserService {
			throw new Exception('You cannot set an email address with a Murena domain as recovery email address.');
		}
	}
		return $this->addNewUserToLDAP($displayname, $recoveryEmail, $username, $userEmail, $password);
		
	}
	/**
	 * Add a new user to the LDAP directory.
	 *