Skip to content

Commit

Permalink
Do not set email without saving
Browse files Browse the repository at this point in the history
- We should sync from auth0 when we get an id_token, but that can be
  added later
  • Loading branch information
henrikhorluck committed Feb 28, 2024
1 parent 9e52d99 commit 2ba3f8e
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions apps/authentication/backends.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

from apps.authentication.auth0 import auth0_client

from .models import OnlineUser


def provider_logout(request):
# this is in accordance with
Expand Down Expand Up @@ -109,7 +111,20 @@ def create_user(self, claims):

return user

def update_user(self, user, claims):
def update_user(self, user: OnlineUser, claims):
# if email was updated in Auth0-dashboard instead of through OW
user.email = claims.get("email")
# changed = False
# if user.email == claims.get("email"):
# user.email = claims.get("email")
# changed = True
# TODO: move source of truth to auth0
# if given_name := claims.get("given_name"):
# user.first_name = given_name
# if family_name := claims.get("family_name"):
# user.first_name = family_name
# if gender := claims.get("gender"):
# user.gender = gender
# if changed:
# user.save()

return super().update_user(user, claims)

0 comments on commit 2ba3f8e

Please sign in to comment.