When using django allauth for social account registration allauth defines the username automatically as first_name grabed from 3rdparty. So, for example: if facebooks John Cucumber registers he gets username "john". I would like to change this to "john cucumber". Use both his first and last name as username. Didn't see anything about this in docs.
Thanks
EDIT : Some more explanation:
Anonymity is not default I am trying to achieve that as default the users are not anonymous (using nicknames). They have the ability to change username to nick, but only after fully registered, by default they use full name from social network.
Registration is quick (no forms) I also want to have them registered and login quickly (that is why I am using social network login in the first place, one click and you are a user of my page). So, I don't wanto bother users with registration forms. As pointed out in Andrew's post below the current setup of allauth causes many names conflicts (there can be only one John all others need to change they username). There will be less conflicts with full names than with first names. But this is something I go after later, once this issue is solved.
I think it will be a short matter of time before your users start seeing conflicts with the generated usernames. As soon as you have more than one "John Smith" then you'll have a problem.
Also, many users may prefer not to have their full name as their username.
Personally, I always use email for the login, never usernames, but if you're adamant about it, I'd recommend that you show a form allowing the choice of username and giving the default as "%s %s" % (first_name, last_name) or similar.
To ensure the form is displayed, edit settings:
SOCIALACCOUNT_AUTO_SIGNUP = False # require social accounts to use the signup form
From the documentation:
[If true] Attempt to bypass the signup form by using fields (e.g. username, email) retrieved from the social account provider. If a conflict arises due to a duplicate e-mail address the signup form will still kick in.
You should be able to use a hook to supply the suggested username before the form is rendered.
A working example* of django-allauth with Twitter Bootstrap is at https://github.com/aellerton/demo-allauth-bootstrap. However, it does not use usernames but it does show the signup form after social signup.
*Disclaimer: I wrote the example.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With