6👍
We used django-registration
with a custom backend, where we overwrote (or defined) the clean
method of the registration form:
def clean(self):
...
# use the email as the username
if 'email' in self.cleaned_data:
self.cleaned_data['username'] = self.cleaned_data['email']
There are other ways:
- http://bitbucket.org/hakanw/django-email-usernames/wiki/Home
- http://djangosnippets.org/snippets/74/
- http://www.davidcramer.net/code/224/logging-in-with-email-addresses-in-django.html
Note that by default, usernames can be only 30 chars long. You’ll need a hack for that, too:
👤miku
0👍
Since Django 1.5
now it possible to have custom auth.User and make email address as username.
- [Django]-Django Postgresql syncdb error
- [Django]-Django social-auth: Fetching date of birth, address, and more fields from facebook
Source:stackexchange.com