Skip to content

Commit

Permalink
fixing adding census to user-and-password users (#195)
Browse files Browse the repository at this point in the history
  • Loading branch information
edulix committed Apr 25, 2022
1 parent 9063f20 commit 0555401
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions authapi/authmethods/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,8 @@ def edit_user(user, req, auth_event):

if auth_event.extra_fields:
for extra in auth_event.extra_fields:
if extra.get('type') not in req:
continue
if extra.get('type') == 'email' and req.get(extra.get('name')):
user.email = req.get(extra.get('name'))
req.pop(extra.get('name'))
Expand Down Expand Up @@ -851,7 +853,10 @@ def get_trimmed_user_req(req, ae):

if ae.extra_fields:
for extra in ae.extra_fields:
if extra.get('type') in ['password', 'image']:
if (
extra.get('type') in ['password', 'image'] and
extra.get('name') in metadata
):
metadata.pop(extra.get('name'))

return metadata
Expand All @@ -865,7 +870,10 @@ def get_trimmed_user(user, ae):

if ae.extra_fields:
for extra in ae.extra_fields:
if extra.get('type') in ['password', 'image']:
if (
extra.get('type') in ['password', 'image'] and
extra.get('name') in metadata
):
metadata.pop(extra.get('name'))

if user.email:
Expand Down

0 comments on commit 0555401

Please sign in to comment.