Fixing bugs around login with blank password using full password. Also fixing bug in signups with no username.

This commit is contained in:
Samuel Clay 2012-02-28 11:29:34 -08:00
parent 1c761c8eb0
commit ed8722e653

View file

@ -33,7 +33,7 @@ class LoginForm(forms.Form):
email_username = User.objects.filter(email=username)
if email_username:
self.user_cache = authenticate(username=email_username[0].username, password=password)
if self.username is None:
if self.user_cache is None:
self.user_cache = authenticate(username=email_username[0].username, password="")
if self.user_cache is None:
# logging.info(" ***> [%s] Bad Login: TRYING JK-LESS PASSWORD" % username)
@ -97,8 +97,8 @@ class SignupForm(forms.Form):
return self.cleaned_data['email']
def clean(self):
username = self.cleaned_data['username']
password = self.cleaned_data['password']
username = self.cleaned_data.get('username', '')
password = self.cleaned_data.get('password', '')
exists = User.objects.filter(username__iexact=username).count()
if exists:
user_auth = authenticate(username=username, password=password)