mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #25232 -- Made ModelBackend/RemoteUserBackend reject inactive users.
This commit is contained in:
committed by
Tim Graham
parent
1555d50ea4
commit
e0a3d93730
@@ -437,6 +437,12 @@ class ClientTest(TestCase):
|
||||
login = self.client.login(username='inactive', password='password')
|
||||
self.assertFalse(login)
|
||||
|
||||
@override_settings(
|
||||
AUTHENTICATION_BACKENDS=[
|
||||
'django.contrib.auth.backends.ModelBackend',
|
||||
'django.contrib.auth.backends.AllowAllUsersModelBackend',
|
||||
]
|
||||
)
|
||||
def test_view_with_inactive_force_login(self):
|
||||
"Request a page that is protected with @login, but use an inactive login"
|
||||
|
||||
@@ -445,7 +451,7 @@ class ClientTest(TestCase):
|
||||
self.assertRedirects(response, '/accounts/login/?next=/login_protected_view/')
|
||||
|
||||
# Log in
|
||||
self.client.force_login(self.u2)
|
||||
self.client.force_login(self.u2, backend='django.contrib.auth.backends.AllowAllUsersModelBackend')
|
||||
|
||||
# Request a page that requires a login
|
||||
response = self.client.get('/login_protected_view/')
|
||||
|
||||
Reference in New Issue
Block a user