diff --git a/backend/helpers/kratos_user.py b/backend/helpers/kratos_user.py index 34f0527a57382d3bbde8d3daffad46866f551ccd..242d8790ca17ced55cdd41fef6411a1f203a43b0 100644 --- a/backend/helpers/kratos_user.py +++ b/backend/helpers/kratos_user.py @@ -150,23 +150,12 @@ class KratosUser(): kratos_id = None - # Get out user ID by iterating over all available IDs - page = 0 - while page >= 0: - if page == 0: - data = api.list_identities(per_page=1000) - else: - data = api.list_identities(per_page=1000, page=page) - for kratos_obj in data: - # Unique identifier we use - if kratos_obj.traits['email'] == email: - kratos_id = str(kratos_obj.id) - return KratosUser(api, kratos_id) - if len(data) == 0: - page = -1 - else: - page = page + 1 - + data = api.list_identities(credentials_identifier=email) + for kratos_obj in data: + if kratos_obj.traits['email'].lower() == email.lower(): + kratos_id = str(kratos_obj.id) + return KratosUser(api, kratos_id) + # No user found with matching email address. return None @staticmethod