Ticket #15366: 15366.diff

File 15366.diff, 1.4 KB (added by hjeffrey, 14 years ago)
  • django/contrib/auth/__init__.py

     
    5353    for backend in get_backends():
    5454        try:
    5555            user = backend.authenticate(**credentials)
     56            if hasattr(backend,'supports_inactive_user'):
     57                user.active_required = not backend.supports_inactive_user
     58            else:
     59                user.active_required = True
    5660        except TypeError:
    5761            # This backend doesn't accept these credentials as arguments. Try the next one.
    5862            continue
  • django/contrib/auth/forms.py

     
    8585            self.user_cache = authenticate(username=username, password=password)
    8686            if self.user_cache is None:
    8787                raise forms.ValidationError(_("Please enter a correct username and password. Note that both fields are case-sensitive."))
    88             elif not self.user_cache.is_active:
     88            elif not self.user_cache.is_active and self.user_cache.active_required:
    8989                raise forms.ValidationError(_("This account is inactive."))
    9090        self.check_for_test_cookie()
    9191        return self.cleaned_data
Back to Top