diff --git a/monkey/monkey_island/cc/services/authentication_service.py b/monkey/monkey_island/cc/services/authentication_service.py index 7b32e4f1c..225f57e50 100644 --- a/monkey/monkey_island/cc/services/authentication_service.py +++ b/monkey/monkey_island/cc/services/authentication_service.py @@ -18,6 +18,10 @@ from monkey_island.cc.setup.mongo.database_initializer import reset_database class AuthenticationService: + """ + A service for user authentication + """ + def __init__( self, data_dir: Path, @@ -29,9 +33,21 @@ class AuthenticationService: self._repository_encryptor = repository_encryptor def needs_registration(self) -> bool: + """ + Checks if a user is already registered on the Island + + :return: Whether registration is required on the Island + """ return not self._user_repository.has_registered_users() def register_new_user(self, username: str, password: str): + """ + Registers a new user on the Island, then resets the encryptor and database + + :param username: Username to register + :param password: Password to register + :raises InvalidRegistrationCredentialsError: If username or password is empty + """ if not username or not password: raise InvalidRegistrationCredentialsError("Username or password can not be empty.")