Hi all,
Firstly, this is not the question how to authenticate on email/password pair, but rather how to produce logical, and if you like, beautiful data structure.
I want to use emails as user names in a given django project. However, I am unable to re-use fields provided by auth.User model for at least two reasons:
auth.User.username 's field max_length is 30 characters, which might not be enough for some email addresses.
auth.User.email is not unique - which is obviously not satisfactory for a prerequisite saying that user names have to be unique.
So an obvious way here is to store username in a custom profile, which is linked to auth.User. In this case we have to deal with following problems:
- Generate unique username for auth.User.username - md5 hash of email should be fine here?
- Leave out completely auth.User.email empty - since it's only 75 characters long, while according to RFC 5321 (http://stackoverflow.com/questions/386294/maximum-length-of-a-valid-email-id) email can be as long as 256 characters.
The following problems stem from the proposed solution:
- One is not going to be able to reuse built-in views/templates for standard operations like password reset etc
- In case of email change auth.User.username will have to be updated
To add oil into the fire, django developers are not likely to fix this limitation in any foreseeable future - see http://code.djangoproject.com/ticket/11365
So the question is: is there any other way to do it and do you see any other drawbacks in the solution proposed above?
Thanks!