Hi Tilman, Thanks for bringing this up. I lowercase my e-mail addresses every time - and when I forget I am wading through a pile of shit. (excusez le mot)
Your solution looks neater, because it maintains user input. I have had users who used [email protected] once and later on: [email protected] to log in. (not using his actual name) In addition, we would need a proper form error when we try to create a user having a case-insensitive duplicate e-mail. Wim On Wednesday, 26 February 2014 09:39:53 UTC, Tilman Koschnick wrote: > > Hi Russell, > > On Wed, 2014-02-26 at 15:33 +0800, Russell Keith-Magee wrote: > > > The idea here is that we just ship a normal auth.User, but with email > > identification rather than username. > > I have just implemented an email based User model as well, and was > wondering about case sensitivity in the local part of the address. > > Most if not all final MTAs treat email addresses as case insensitive, > e.g. User.Name@... ist handled the same way as user.name@..., and some > users might not take care or notice of which form they used during > registration. A common recommendation is to preserve but subsequently > ignore case. > > I am handling this by using iexact lookups for users: > > def get_by_natural_key(self, username): > return self.get(email__iexact=username) > > In the database, uniqueness is enforced by an expression index: > > CREATE UNIQUE INDEX app_user_email_key ON app_user (upper(email)) > > I am not sure if DBMSs other than PostgreSQL support expression indexes; > either way, there is not Django support (yet). > > I don't know if this is of only theoretical concern, or a real world > issue - maybe others using email based users could share their > experience (my project is not deployed yet). > > Kind regards, Til > > > -- You received this message because you are subscribed to the Google Groups "Django developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/django-developers/fab46e55-7dad-4d7d-be55-ea13b606431d%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
