Skip to content

Commit

Permalink
Fixed #1991 -- Changed AuthenticationForm to disallow users with is_a…
Browse files Browse the repository at this point in the history
…ctive=False from logging in. Thanks, dave@rightround.com and germish@gmail.com

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3058 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
adrianholovaty committed Jun 2, 2006
1 parent bd5b350 commit 16a07fe
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion django/contrib/auth/forms.py
Expand Up @@ -36,9 +36,13 @@ def isValidUser(self, field_data, all_data):
raise validators.ValidationError, _("Please enter a correct username and password. Note that both fields are case-sensitive.")

def isValidPasswordForUser(self, field_data, all_data):
if self.user_cache is not None and not self.user_cache.check_password(field_data):
if self.user_cache is None:
return
if not self.user_cache.check_password(field_data):
self.user_cache = None
raise validators.ValidationError, _("Please enter a correct username and password. Note that both fields are case-sensitive.")
elif not self.user_cache.is_active:
raise validators.ValidationError, _("This account is inactive.")

def get_user_id(self):
if self.user_cache:
Expand Down

0 comments on commit 16a07fe

Please sign in to comment.