diff --git a/myhpi/core/auth.py b/myhpi/core/auth.py index 29d07219..a3cf975a 100644 --- a/myhpi/core/auth.py +++ b/myhpi/core/auth.py @@ -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 diff --git a/myhpi/tests/core/test_auth.py b/myhpi/tests/core/test_auth.py index d81e7b4b..63998d40 100644 --- a/myhpi/tests/core/test_auth.py +++ b/myhpi/tests/core/test_auth.py @@ -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"] = "jw.goethe@weimar.eu" 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, "jw.goethe@weimar.eu")