diff --git a/monkey/monkey_island/cc/services/authentication/authentication_service.py b/monkey/monkey_island/cc/services/authentication/authentication_service.py index b60c505de..ec191d04e 100644 --- a/monkey/monkey_island/cc/services/authentication/authentication_service.py +++ b/monkey/monkey_island/cc/services/authentication/authentication_service.py @@ -25,7 +25,7 @@ class AuthenticationService: @classmethod def needs_registration(cls) -> bool: - return cls.user_datastore.has_registered_users() + return not cls.user_datastore.has_registered_users() @classmethod def register_new_user(cls, username: str, password: str): diff --git a/monkey/tests/unit_tests/monkey_island/cc/services/authentication/test_authentication_service.py b/monkey/tests/unit_tests/monkey_island/cc/services/authentication/test_authentication_service.py index a92f33e94..3c61594ad 100644 --- a/monkey/tests/unit_tests/monkey_island/cc/services/authentication/test_authentication_service.py +++ b/monkey/tests/unit_tests/monkey_island/cc/services/authentication/test_authentication_service.py @@ -78,7 +78,7 @@ def test_needs_registration__true(tmp_path): a_s = AuthenticationService() a_s.initialize(tmp_path, mock_user_datastore) - assert a_s.needs_registration() + assert not a_s.needs_registration() def test_needs_registration__false(tmp_path): @@ -87,7 +87,7 @@ def test_needs_registration__false(tmp_path): a_s = AuthenticationService() a_s.initialize(tmp_path, mock_user_datastore) - assert not a_s.needs_registration() + assert a_s.needs_registration() @pytest.mark.parametrize("error", [InvalidRegistrationCredentialsError, AlreadyRegisteredError])