pombreda / django-hotclub

Automatically exported from code.google.com/p/django-hotclub
MIT License
0 stars 0 forks source link

username is case sensitive #180

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. create an account with a capitol letter in the username
2. post something on the microblogging secion (make a tweet)
3. try to view the feed

the code that generates the feed converts your username to lowercase making
it impossible to get to you feed no matter how you type it in the url.

The easy solution is to just change the code to use the case in the url
instead of using .lower() but I think the site should convert the username
to lowercase everywhere there is a comparison or matching algorith so that
you can log in without worrying about case sensitivity etc.

My webhost is webfactional. And I'm using pinax 0.5.1 (though it's very
heavily modified)

Original issue reported on code.google.com by Jim.mixt...@gmail.com on 7 Feb 2009 at 9:31

GoogleCodeExporter commented 9 years ago
I've produced a patch to fix this issue

Original comment by Jim.mixt...@gmail.com on 23 Feb 2009 at 4:56

Attachments:

GoogleCodeExporter commented 9 years ago
oops sorry I should have explained the patch... it doesn't deal with the feeds 
that I
mentioned in the bug report.

it allows users to login without worrying about the capitolization of their 
username
(which shouldn't be an issue since it uses a case insensitive lookup when it 
checks
for a username's availability on signup)... I solved the feed issue by changing 
the
username lookup to username__iexact like I did in this patch

Original comment by Jim.mixt...@gmail.com on 23 Feb 2009 at 4:58

GoogleCodeExporter commented 9 years ago

Original comment by jtau...@gmail.com on 16 Mar 2009 at 3:08

GoogleCodeExporter commented 9 years ago
Hello,

I am looking for a solution to this problem as well, I used you patch but then 
when a user types in an invalid 
username for login I get a django error isntead of a form validation error 
"user password incorrect".
Do you by chance have a fix for this?

Original comment by Tristanb...@gmail.com on 16 Apr 2009 at 4:28

GoogleCodeExporter commented 9 years ago
just put the username__iexact  line in a try block and catch the django error 
like so:

try:
    attemptUser = User.objects.get(username__iexact=self.cleaned_data["username"]
    cleanUsername = attemptUser.username
except User.DoesNotExist:
    # if it's not a real username, just let the form return as expected
    cleanUsername = self.cleaned_data["username"]

user = authenticate(username=cleanUsername, 
password=self.cleaned_data["password"])

Original comment by Jim.mixt...@gmail.com on 17 Apr 2009 at 2:18

GoogleCodeExporter commented 9 years ago
Hi Jim,

Posted on the groups but incase you see this first.
Am I missing something else, because with the format:

(pasted here)

http://rafb.net/p/XupW7f28.html

I get a syntax error. (sorry if this is a silly mistake i'm new to python).

Original comment by Tristanb...@gmail.com on 17 Apr 2009 at 7:56

GoogleCodeExporter commented 9 years ago
Fixed with this: :) sorry

http://rafb.net/p/NybUeP87.html 

Original comment by Tristanb...@gmail.com on 17 Apr 2009 at 8:47