Sorry, Django newbie here. I'm having great success with allauth, which is awesome, but noticed one little annoyance which I think I've worked around correctly, but just checking.
The login message shows "Successfully signed in as {{name}}." as a django message on successful login. However if you are using email instead of usernames, this is fairly pointless as the username is auto-generated (from first part of email + increment number?) and meaningless to the user.
This seems to stem from {% user_display user as name %}, which in turn comes uses ACCOUNT_USER_DISPLAY. As per the documentation "The default implementation returns user.username."
But if I'm not using usernames (i.e. by the following settings)
ACCOUNT_AUTHENTICATION_METHOD = 'email'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_USERNAME_REQUIRED = False
shouldn't the user_display / ACCOUNT_USER_DISPLAY be made to automatically return user.email instead? I've currently got a workaround coded up:
def user_display_email(user):
return getattr(user, 'email', user.username)
ACCOUNT_USER_DISPLAY = user_display_email
I'm using getattr as otherwise user_display does not work when not logged in ('AnonymousUser' object has no attribute 'email') - not that you should be using it on a AnonymousUser, but that's another issue :)
Is this is best way to do that? Or is there another setting I should be changing? Just noticed it still shows the user.username in the django admin heading. Is there some global setting for that, or is using user.username just too embedded into code everywhere? I guess that's more a Django issue that allauth.