Skip to content
Snippets Groups Projects
Commit e93c2578 authored by Arie Peterson's avatar Arie Peterson
Browse files

Use kratos api for looking up user by email address

parent 363c4afb
No related branches found
No related tags found
1 merge request!186Resolve "User provisioning fails because app converts case in email address"
Pipeline #46199 passed with stages
in 5 minutes and 10 seconds
...@@ -150,23 +150,12 @@ class KratosUser(): ...@@ -150,23 +150,12 @@ class KratosUser():
kratos_id = None kratos_id = None
# Get out user ID by iterating over all available IDs data = api.list_identities(credentials_identifier=email)
page = 0 for kratos_obj in data:
while page >= 0: if kratos_obj.traits['email'].lower() == email.lower():
if page == 0: kratos_id = str(kratos_obj.id)
data = api.list_identities(per_page=1000) return KratosUser(api, kratos_id)
else: # No user found with matching email address.
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
return None return None
@staticmethod @staticmethod
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment