diff --git a/django/contrib/admin/forms.py b/django/contrib/admin/forms.py
index f26c100..e790e2e 100644
a
|
b
|
from django.contrib.auth.models import User
|
6 | 6 | |
7 | 7 | from django.utils.translation import ugettext_lazy, ugettext as _ |
8 | 8 | |
9 | | ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. " |
10 | | "Note that both fields are case-sensitive.") |
| 9 | ERROR_MESSAGE = ugettext_lazy("Please enter the correct username and password " |
| 10 | "for a staff account. Note that both fields are case-sensitive.") |
11 | 11 | |
12 | 12 | class AdminAuthenticationForm(AuthenticationForm): |
13 | 13 | """ |
diff --git a/tests/regressiontests/admin_views/tests.py b/tests/regressiontests/admin_views/tests.py
index 22b65a6..7ffbbdc 100644
a
|
b
|
from models import (Article, BarAccount, CustomArticle, EmptyModel,
|
40 | 40 | RowLevelChangePermissionModel, Paper, CoverLetter, Story, OtherStory, |
41 | 41 | ComplexSortedPerson, Parent, Child) |
42 | 42 | |
| 43 | ERROR_MESSAGE = "Please enter the correct username and password \ |
| 44 | for a staff account. Note that both fields are case-sensitive." |
| 45 | |
43 | 46 | |
44 | 47 | class AdminViewBasicTest(TestCase): |
45 | 48 | fixtures = ['admin-views-users.xml', 'admin-views-colors.xml', |
… |
… |
class AdminViewPermissionsTest(TestCase):
|
754 | 757 | self.assertContains(login, "Your e-mail address is not your username") |
755 | 758 | # only correct passwords get a username hint |
756 | 759 | login = self.client.post('/test_admin/admin/', self.super_email_bad_login) |
757 | | self.assertContains(login, "Please enter a correct username and password.") |
| 760 | self.assertContains(login, ERROR_MESSAGE) |
758 | 761 | new_user = User(username='jondoe', password='secret', email='super@example.com') |
759 | 762 | new_user.save() |
760 | 763 | # check to ensure if there are multiple e-mail addresses a user doesn't get a 500 |
761 | 764 | login = self.client.post('/test_admin/admin/', self.super_email_login) |
762 | | self.assertContains(login, "Please enter a correct username and password.") |
| 765 | self.assertContains(login, ERROR_MESSAGE) |
763 | 766 | |
764 | 767 | # Add User |
765 | 768 | request = self.client.get('/test_admin/admin/') |
… |
… |
class AdminViewPermissionsTest(TestCase):
|
790 | 793 | self.assertEqual(request.status_code, 200) |
791 | 794 | login = self.client.post('/test_admin/admin/', self.joepublic_login) |
792 | 795 | self.assertEqual(login.status_code, 200) |
793 | | self.assertContains(login, "Please enter a correct username and password.") |
| 796 | self.assertContains(login, ERROR_MESSAGE) |
794 | 797 | |
795 | 798 | # Requests without username should not return 500 errors. |
796 | 799 | request = self.client.get('/test_admin/admin/') |
… |
… |
class SecureViewTests(TestCase):
|
1350 | 1353 | self.assertContains(login, "Your e-mail address is not your username") |
1351 | 1354 | # only correct passwords get a username hint |
1352 | 1355 | login = self.client.post('/test_admin/admin/secure-view/', self.super_email_bad_login) |
1353 | | self.assertContains(login, "Please enter a correct username and password.") |
| 1356 | self.assertContains(login, ERROR_MESSAGE) |
1354 | 1357 | new_user = User(username='jondoe', password='secret', email='super@example.com') |
1355 | 1358 | new_user.save() |
1356 | 1359 | # check to ensure if there are multiple e-mail addresses a user doesn't get a 500 |
1357 | 1360 | login = self.client.post('/test_admin/admin/secure-view/', self.super_email_login) |
1358 | | self.assertContains(login, "Please enter a correct username and password.") |
| 1361 | self.assertContains(login, ERROR_MESSAGE) |
1359 | 1362 | |
1360 | 1363 | # Add User |
1361 | 1364 | request = self.client.get('/test_admin/admin/secure-view/') |
… |
… |
class SecureViewTests(TestCase):
|
1387 | 1390 | login = self.client.post('/test_admin/admin/secure-view/', self.joepublic_login) |
1388 | 1391 | self.assertEqual(login.status_code, 200) |
1389 | 1392 | # Login.context is a list of context dicts we just need to check the first one. |
1390 | | self.assertContains(login, "Please enter a correct username and password.") |
| 1393 | self.assertContains(login, ERROR_MESSAGE) |
1391 | 1394 | |
1392 | 1395 | # 8509 - if a normal user is already logged in, it is possible |
1393 | 1396 | # to change user into the superuser without error |