Django

Code

Changeset 3058

Show
Ignore:
Timestamp:
06/01/06 23:42:10 (2 years ago)
Author:
adrian
Message:

Fixed #1991 -- Changed AuthenticationForm? to disallow users with is_active=False from logging in. Thanks, dave@rightround.com and germish@gmail.com

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • django/trunk/django/contrib/auth/forms.py

    r2809 r3058  
    3737 
    3838    def isValidPasswordForUser(self, field_data, all_data): 
    39         if self.user_cache is not None and not self.user_cache.check_password(field_data): 
     39        if self.user_cache is None: 
     40            return 
     41        if not self.user_cache.check_password(field_data): 
    4042            self.user_cache = None 
    4143            raise validators.ValidationError, _("Please enter a correct username and password. Note that both fields are case-sensitive.") 
     44        elif not self.user_cache.is_active: 
     45            raise validators.ValidationError, _("This account is inactive.") 
    4246 
    4347    def get_user_id(self):