Revisiting the case-sensitive login for the default user manager

34 views
Skip to first unread message

Roman Onosovski

unread,
Dec 19, 2014, 10:53:23 AM12/19/14
to django...@googlegroups.com
Hello fellow Djangoers, I am new to the framework and just recently built a site using it.
However I was not aware of the username hurdle until just recently.
I did some research and found that I can make my own user manager and etc.

Now this is probably a bit of a hack, but tell me what you think.

I am on 1.6.5 and I did this:

from:

def get_by_natural_key(self, username):
        return self.get(**{self.model.USERNAME_FIELD: username})

to:

def get_by_natural_key(self, username):
        return self.get(username__iexact=username)

It works and does what I need it to do. How illegal is this and what potential problems can this create that I may not see now?

Thanks guys

Collin Anderson

unread,
Dec 21, 2014, 12:01:10 AM12/21/14
to django...@googlegroups.com
Hi Roman,

That might be good enough, as long as you don't have any name conflicts already. Just make sure it prevents new users from signing up with a different case of an existing username.

Collin
Reply all
Reply to author
Forward
0 new messages