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
Tags 0.10.2
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():
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
......
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