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 django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
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/1393407593.6478.21.camel%40mother.subnetz.org.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to