Ticket #12103: 12103.diff

File 12103.diff, 1.1 KB (added by Ethan Jucovy, 15 years ago)
  • django/contrib/auth/forms.py

     
    5959    username = forms.CharField(label=_("Username"), max_length=30)
    6060    password = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
    6161
     62    allow_inactive_logins = False
     63
    6264    def __init__(self, request=None, *args, **kwargs):
    6365        """
    6466        If request is passed in, the form will validate that cookies are
     
    7880            self.user_cache = authenticate(username=username, password=password)
    7981            if self.user_cache is None:
    8082                raise forms.ValidationError(_("Please enter a correct username and password. Note that both fields are case-sensitive."))
    81             elif not self.user_cache.is_active:
     83            elif not self.allow_inactive_logins and not self.user_cache.is_active:
    8284                raise forms.ValidationError(_("This account is inactive."))
    8385
    8486        # TODO: determine whether this should move to its own method.
Back to Top