Opened 6 years ago

Closed 6 years ago

Last modified 5 years ago

#16709 closed Uncategorized (wontfix)

Allow username to be longer than 30 characters to use e-mailaddresses as username

Reported by: wim@… Owned by: nobody
Component: contrib.auth Version: 1.3
Severity: Normal Keywords:
Cc: Francis Devereux Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


Some email addresses are longer than 30 characters. It is not possible to use those as a username, except by monkey patching / overwriting django's default User model.

I would like to set the constraint less strict and allow for usernames to be up to 128 characters for example, like the password.

Attachments (2)

patch_for_ticket16123.diff (1.9 KB) - added by wim@… 6 years ago.
patch for 128-char usernames
username_of_128chars.diff (2.7 KB) - added by wim@… 6 years ago.
patch for making usernames 128 characters

Download all attachments as: .zip

Change History (8)

Changed 6 years ago by wim@…

Attachment: patch_for_ticket16123.diff added

patch for 128-char usernames

Changed 6 years ago by wim@…

Attachment: username_of_128chars.diff added

patch for making usernames 128 characters

comment:1 Changed 6 years ago by wim@…

Obviously I added the wrong patch, please use the second one.

comment:2 Changed 6 years ago by Aymeric Augustin

Resolution: duplicate
Status: newclosed

This is a duplicate of #7591, see comment number 4 for a solution.

A Google search for " email as username" turns up several tickets related to this controversial topic.

comment:3 Changed 6 years ago by wim@…

Resolution: duplicate
Status: closedreopened

Hi Aymeric Augustin,

Thanks for looking into the ticket. I've seen a lot of different custom EmailBackEnds on google today, actually that's why I think we need one in Django, because there is a demand. Django claims to encourage rapid development, I believe it should have this option. Allowing logging in using a username and not using an e-mail seems like an arbitrary decision to me, not a well-argumented one.

For me implementing nr. 4 is not a proper solution, several problems are outlined here: Moreover, the argument being used ("it is easy to do it yourself") sounds similar to the argument against truncatechars.

My belief is that it might be a very easy change to allow for longer usernames. I'm wondering what are the reasons against it?

I am reopening this ticket, though I'm not sure if it's the right way to do things, I'm sorry if I am mistaken. Again, thanks for your time looking into this!

comment:4 Changed 6 years ago by Aymeric Augustin

I see that you've started a discussion thread on django-developers. This is a good idea for two reasons:

  • Jacob Kaplan-Moss issued a "wontfix" on this idea in #7591, and the canonical way to reverse a "wontfix" by a core developer is to obtain a consensus on the mailing list;
  • there's no obvious way to implement username as login — as you say, many people have attempted to resolve this problem in different ways, with more or less convincing results.

Let's keep this ticket as "unreviewed" for now, we'll see in a few days where the discussion goes.

For the record, and for what my opinion is worth, I think that this issue won't be solved until someone spends a few months (full-time) to write the next version of django.contrib.auth, typically in the context of a GSoC: — which is covered by #3011.

Last edited 6 years ago by Aymeric Augustin (previous) (diff)

comment:5 Changed 6 years ago by Russell Keith-Magee

Resolution: wontfix
Status: reopenedclosed

No, let's not keep this as unreviewed. It ain't gonna happen like this.

There is a very good reason that this proposal keeps getting rejected, and that reason hasn't changed - we dont have a way to manage the data migration. We simply *cannot* change the length of the username field because we can't change the existing databases of almost every Django install in existence.

The core-endorsed ticket for this problem is #3011. The patch on that ticket isn't endorsed, but it points at the real problem - a need to be able to specify a custom User model. There have been several discussions directed at this problem, and I'm hoping to get a posse discussing this at the upcoming DjangoCon sprints. If you want background on some approaches that might work (and some that won't) search the archives for Lazy Foreign Key.

comment:6 Changed 5 years ago by Francis Devereux

Cc: Francis Devereux added
Note: See TracTickets for help on using tickets.
Back to Top