Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[1.3.X] Reverting r16878 (improved admin error message) per advice fr…

…om jezdez. refs #16837

git-svn-id: http://code.djangoproject.com/svn/django/branches/releases/1.3.X@16891 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit e3bc2590816b684bc44ce8516b3786a5027cc384 1 parent ed156a4
Paul McMillan authored September 22, 2011
4  django/contrib/admin/forms.py
@@ -6,8 +6,8 @@
6 6
 
7 7
 from django.utils.translation import ugettext_lazy, ugettext as _
8 8
 
9  
-ERROR_MESSAGE = ugettext_lazy("Please enter the correct username and password "
10  
-        "for a staff account. Note that both fields are case-sensitive.")
  9
+ERROR_MESSAGE = ugettext_lazy("Please enter a correct username and password. "
  10
+                              "Note that both fields are case-sensitive.")
11 11
 
12 12
 class AdminAuthenticationForm(AuthenticationForm):
13 13
     """
15  tests/regressiontests/admin_views/tests.py
@@ -38,9 +38,6 @@
38 38
     Question, Answer, Inquisition, Actor, FoodDelivery,
39 39
     RowLevelChangePermissionModel, Paper, CoverLetter, Story, OtherStory)
40 40
 
41  
-ERROR_MESSAGE = "Please enter the correct username and password \
42  
-for a staff account. Note that both fields are case-sensitive."
43  
-
44 41
 
45 42
 class AdminViewBasicTest(TestCase):
46 43
     fixtures = ['admin-views-users.xml', 'admin-views-colors.xml',
@@ -641,12 +638,12 @@ def testLogin(self):
641 638
         self.assertContains(login, "Your e-mail address is not your username")
642 639
         # only correct passwords get a username hint
643 640
         login = self.client.post('/test_admin/admin/', self.super_email_bad_login)
644  
-        self.assertContains(login, ERROR_MESSAGE)
  641
+        self.assertContains(login, "Please enter a correct username and password.")
645 642
         new_user = User(username='jondoe', password='secret', email='super@example.com')
646 643
         new_user.save()
647 644
         # check to ensure if there are multiple e-mail addresses a user doesn't get a 500
648 645
         login = self.client.post('/test_admin/admin/', self.super_email_login)
649  
-        self.assertContains(login, ERROR_MESSAGE)
  646
+        self.assertContains(login, "Please enter a correct username and password.")
650 647
 
651 648
         # Add User
652 649
         request = self.client.get('/test_admin/admin/')
@@ -677,7 +674,7 @@ def testLogin(self):
677 674
         self.assertEqual(request.status_code, 200)
678 675
         login = self.client.post('/test_admin/admin/', self.joepublic_login)
679 676
         self.assertEqual(login.status_code, 200)
680  
-        self.assertContains(login, ERROR_MESSAGE)
  677
+        self.assertContains(login, "Please enter a correct username and password.")
681 678
 
682 679
         # Requests without username should not return 500 errors.
683 680
         request = self.client.get('/test_admin/admin/')
@@ -1237,12 +1234,12 @@ def test_staff_member_required_decorator_works_as_per_admin_login(self):
1237 1234
         self.assertContains(login, "Your e-mail address is not your username")
1238 1235
         # only correct passwords get a username hint
1239 1236
         login = self.client.post('/test_admin/admin/secure-view/', self.super_email_bad_login)
1240  
-        self.assertContains(login, ERROR_MESSAGE)
  1237
+        self.assertContains(login, "Please enter a correct username and password.")
1241 1238
         new_user = User(username='jondoe', password='secret', email='super@example.com')
1242 1239
         new_user.save()
1243 1240
         # check to ensure if there are multiple e-mail addresses a user doesn't get a 500
1244 1241
         login = self.client.post('/test_admin/admin/secure-view/', self.super_email_login)
1245  
-        self.assertContains(login, ERROR_MESSAGE)
  1242
+        self.assertContains(login, "Please enter a correct username and password.")
1246 1243
 
1247 1244
         # Add User
1248 1245
         request = self.client.get('/test_admin/admin/secure-view/')
@@ -1274,7 +1271,7 @@ def test_staff_member_required_decorator_works_as_per_admin_login(self):
1274 1271
         login = self.client.post('/test_admin/admin/secure-view/', self.joepublic_login)
1275 1272
         self.assertEqual(login.status_code, 200)
1276 1273
         # Login.context is a list of context dicts we just need to check the first one.
1277  
-        self.assertContains(login, ERROR_MESSAGE)
  1274
+        self.assertContains(login, "Please enter a correct username and password.")
1278 1275
 
1279 1276
         # 8509 - if a normal user is already logged in, it is possible
1280 1277
         # to change user into the superuser without error

0 notes on commit e3bc259

Please sign in to comment.
Something went wrong with that request. Please try again.