mirror of
https://github.com/django/django.git
synced 2025-10-31 09:41:08 +00:00
Fixed #28645 -- Reallowed AuthenticationForm to raise the inactive user error when using ModelBackend.
Regression in e0a3d93730.
Thanks Guilherme Junqueira for the report and Tim Graham for the review.
This commit is contained in:
@@ -262,9 +262,6 @@ class UserCreationFormTest(TestDataMixin, TestCase):
|
||||
)
|
||||
|
||||
|
||||
# To verify that the login form rejects inactive users, use an authentication
|
||||
# backend that allows them.
|
||||
@override_settings(AUTHENTICATION_BACKENDS=['django.contrib.auth.backends.AllowAllUsersModelBackend'])
|
||||
class AuthenticationFormTest(TestDataMixin, TestCase):
|
||||
|
||||
def test_invalid_username(self):
|
||||
@@ -323,6 +320,8 @@ class AuthenticationFormTest(TestDataMixin, TestCase):
|
||||
self.assertFalse(form.is_valid())
|
||||
self.assertEqual(form.non_field_errors(), [str(form.error_messages['inactive'])])
|
||||
|
||||
# Use an authentication backend that allows inactive users.
|
||||
@override_settings(AUTHENTICATION_BACKENDS=['django.contrib.auth.backends.AllowAllUsersModelBackend'])
|
||||
def test_custom_login_allowed_policy(self):
|
||||
# The user is inactive, but our custom form policy allows them to log in.
|
||||
data = {
|
||||
|
||||
Reference in New Issue
Block a user