diff --git a/django/contrib/auth/backends.py b/django/contrib/auth/backends.py
index 9f08259..3f3d1fa 100644
a
|
b
|
class ModelBackend(object):
|
15 | 15 | username = kwargs.get(UserModel.USERNAME_FIELD) |
16 | 16 | try: |
17 | 17 | user = UserModel._default_manager.get_by_natural_key(username) |
18 | | if user.check_password(password): |
| 18 | if user.check_password(password) and user.is_active: |
19 | 19 | return user |
20 | 20 | except UserModel.DoesNotExist: |
21 | 21 | # Run the default password hasher once to reduce the timing |
… |
… |
class ModelBackend(object):
|
90 | 90 | def get_user(self, user_id): |
91 | 91 | UserModel = get_user_model() |
92 | 92 | try: |
93 | | return UserModel._default_manager.get(pk=user_id) |
| 93 | user = UserModel._default_manager.get(pk=user_id) |
94 | 94 | except UserModel.DoesNotExist: |
95 | 95 | return None |
| 96 | return user if user.is_active else None |
96 | 97 | |
97 | 98 | |
98 | 99 | class RemoteUserBackend(ModelBackend): |
diff --git a/django/test/client.py b/django/test/client.py
index 945fa13..a44970a 100644
a
|
b
|
class Client(RequestFactory):
|
594 | 594 | """ |
595 | 595 | from django.contrib.auth import authenticate |
596 | 596 | user = authenticate(**credentials) |
597 | | if (user and user.is_active and |
598 | | apps.is_installed('django.contrib.sessions')): |
| 597 | if user and apps.is_installed('django.contrib.sessions'): |
599 | 598 | self._login(user) |
600 | 599 | return True |
601 | 600 | else: |
diff --git a/tests/i18n/commands/locale/en/LC_MESSAGES/django.mo b/tests/i18n/commands/locale/en/LC_MESSAGES/django.mo
old mode 100644
new mode 100755
diff --git a/tests/test_client/tests.py b/tests/test_client/tests.py
index ae70f5c..c016735 100644
a
|
b
|
class ClientTest(TestCase):
|
461 | 461 | self.assertRedirects(response, '/accounts/login/?next=/login_protected_view/') |
462 | 462 | |
463 | 463 | # Log in |
464 | | self.client.force_login(self.u2) |
465 | | |
466 | | # Request a page that requires a login |
467 | | response = self.client.get('/login_protected_view/') |
468 | | self.assertEqual(response.status_code, 200) |
469 | | self.assertEqual(response.context['user'].username, 'inactive') |
| 464 | self.assertFalse(self.client.force_login(self.u2)) |
470 | 465 | |
471 | 466 | def test_logout(self): |
472 | 467 | "Request a logout after logging in" |