Skip to content

Commit

Permalink
do not update names from OIDC (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeriox authored Oct 19, 2023
1 parent e568eca commit c4ba9c7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
3 changes: 0 additions & 3 deletions myhpi/core/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,7 @@ def create_user(self, claims):
return user

def update_user(self, user, claims):
user.first_name = claims.get("given_name", "")
user.last_name = claims.get("family_name", "")
user.email = mail_replacement(claims.get("email"))

user.save()

return user
Expand Down
4 changes: 3 additions & 1 deletion myhpi/tests/core/test_auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ def test_update_user(self):
self.assertEqual(user.username, "jw.goethe")
self.assertEqual(user.last_name, "Goethe")
claims["family_name"] = "von Goethe"
claims["email"] = "[email protected]"
user = self.auth_backend.update_user(user, claims)
self.assertEqual(user.first_name, "Johann Wolfgang")
self.assertEqual(user.last_name, "von Goethe")
self.assertEqual(user.last_name, "Goethe")
self.assertEqual(user.email, "[email protected]")

0 comments on commit c4ba9c7

Please sign in to comment.