Ticket #15366: 15366-alternative.diff

File 15366-alternative.diff, 973 bytes (added by Aymeric Augustin, 12 years ago)
  • django/contrib/auth/forms.py

     
    127127                        "enabled. Cookies are required for logging in."),
    128128        'inactive': _("This account is inactive."),
    129129    }
     130    allow_inactive_user = False
    130131
    131132    def __init__(self, request=None, *args, **kwargs):
    132133        """
     
    147148            self.user_cache = authenticate(username=username, password=password)
    148149            if self.user_cache is None:
    149150                raise forms.ValidationError(self.error_messages['invalid_login'])
    150             elif not self.user_cache.is_active:
     151            elif not self.allow_inactive_user and not self.user_cache.is_active:
    151152                raise forms.ValidationError(self.error_messages['inactive'])
    152153        self.check_for_test_cookie()
    153154        return self.cleaned_data
Back to Top