Closed andylolz closed 1 year ago
Apologies for rewording this ticket so many times! Hopefully it’s now a bit clearer what I’m trying to do here.
My current workaround is to create a save_user
adapter that calls super(), then overwrites the user’s username with the custom one, and then resaves the user. This works okay, but I wonder if there’s a better way.
@andylolz Close this and move this conversation to an actual PR! It looks good to me, but i'm just doing triage.
Great – thank you! Done.
I’m authenticating users via email, with
ACCOUNT_USERNAME_REQUIRED
set to false. I’d like to set a custom username for social account logins, that includes the social account’s UID.I’ve created a custom social account adapter. In order to generate the custom username, I think I need access to
sociallogin.account.uid
, which I think rules out usinggenerate_unique_username
orpopulate_username
(since these don’t have access tosociallogin
).I’m instead setting the custom username in
populate_user
. This works correctly for social account auto-signups.However, without auto-signup, the username is thrown away by this bit of the default account adapter: https://github.com/pennersr/django-allauth/blob/985930d303d54b49204d468b3771c811e687eb90/allauth/account/adapter.py#L233-L239
Would it work to change this to:
Would you be happy to accept a pull request to this effect? Thanks,