Saturday, December 20, 2014

Re: Revisiting the case-sensitive login for the default user manager

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

On Friday, December 19, 2014 10:53:23 AM UTC-5, Roman Onosovski wrote:
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

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/bad5dd74-8cd9-44f3-9d35-0ae8c1d7c42c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment