Skip to content

Commit

Permalink
Merge pull request #749 from intuitem/hotfix/sso-no-first-last-name
Browse files Browse the repository at this point in the history
fix: handle no first/last name during sso login
  • Loading branch information
Mohamed-Hacene authored Aug 20, 2024
2 parents c185cd7 + 95f3703 commit 99401fb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions backend/iam/sso/saml/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,14 +135,14 @@ def dispatch(self, request, organization_slug):
email = auth._nameid
user = User.objects.get(email=email)
idp_first_name = auth._attributes.get(
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname"
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/givenname", [""]
)[0]
idp_last_name = auth._attributes.get(
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname"
"http://schemas.xmlsoap.org/ws/2005/05/identity/claims/surname", [""]
)[0]
if user.first_name != idp_first_name:
if idp_first_name and user.first_name != idp_first_name:
user.first_name = idp_first_name
if user.last_name != idp_last_name:
if idp_last_name and user.last_name != idp_last_name:
user.last_name = idp_last_name
user.is_sso = True
user.save()
Expand Down

0 comments on commit 99401fb

Please sign in to comment.