mirror of
https://github.com/cookiecutter/cookiecutter-django.git
synced 2024-11-26 19:44:00 +03:00
Fix bug with social account adapter name override, in very specific conditions (#4650)
* Fix bug with social account adapter in specific condition * Slight refactoring of fix
This commit is contained in:
parent
befc571342
commit
6dea941258
|
@ -27,11 +27,12 @@ class SocialAccountAdapter(DefaultSocialAccountAdapter):
|
|||
|
||||
See: https://django-allauth.readthedocs.io/en/latest/advanced.html?#creating-and-populating-user-instances
|
||||
"""
|
||||
user = sociallogin.user
|
||||
user = super().populate_user(request, sociallogin, data)
|
||||
if not user.name:
|
||||
if name := data.get("name"):
|
||||
user.name = name
|
||||
elif first_name := data.get("first_name"):
|
||||
user.name = first_name
|
||||
if last_name := data.get("last_name"):
|
||||
user.name += f" {last_name}"
|
||||
return super().populate_user(request, sociallogin, data)
|
||||
return user
|
||||
|
|
Loading…
Reference in New Issue
Block a user