diff -r b33d4705456a django/contrib/auth/forms.py
--- a/django/contrib/auth/forms.py	Fri Dec 09 23:16:56 2011 +0000
+++ b/django/contrib/auth/forms.py	Sat Dec 10 14:55:24 2011 +0100
@@ -52,10 +52,14 @@
     """
     username = forms.RegexField(label=_("Username"), max_length=30, regex=r'^[\w.@+-]+$',
         help_text = _("Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only."),
-        error_messages = {'invalid': _("This value may contain only letters, numbers and @/./+/-/_ characters.")})
+        error_messages = {
+            'invalid': _("This value may contain only letters, numbers and @/./+/-/_ characters."),
+            'duplicate': _("A user with that username already exists."),
+        })
     password1 = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
     password2 = forms.CharField(label=_("Password confirmation"), widget=forms.PasswordInput,
-        help_text = _("Enter the same password as above, for verification."))
+        help_text = _("Enter the same password as above, for verification."),
+        error_messages = {'mismatch': _("The two password fields didn't match.")})
 
     class Meta:
         model = User
@@ -67,13 +71,13 @@
             User.objects.get(username=username)
         except User.DoesNotExist:
             return username
-        raise forms.ValidationError(_("A user with that username already exists."))
+        raise forms.ValidationError(self.fields['username'].error_messages['duplicate'])
 
     def clean_password2(self):
         password1 = self.cleaned_data.get("password1", "")
         password2 = self.cleaned_data["password2"]
         if password1 != password2:
-            raise forms.ValidationError(_("The two password fields didn't match."))
+            raise forms.ValidationError(self.fields['password2'].error_messages['mismatch'])
         return password2
 
     def save(self, commit=True):
@@ -109,6 +113,13 @@
     username = forms.CharField(label=_("Username"), max_length=30)
     password = forms.CharField(label=_("Password"), widget=forms.PasswordInput)
 
+    error_messages = {
+        'invalid_login': _("Please enter a correct username and password. Note that both fields are case-sensitive."),
+        'inactive': _("This account is inactive."),
+        'nocookies': _("Your Web browser doesn't appear to have cookies enabled. "
+                      "Cookies are required for logging in."),
+    }
+
     def __init__(self, request=None, *args, **kwargs):
         """
         If request is passed in, the form will validate that cookies are
@@ -127,17 +138,15 @@
         if username and password:
             self.user_cache = authenticate(username=username, password=password)
             if self.user_cache is None:
-                raise forms.ValidationError(_("Please enter a correct username and password. Note that both fields are case-sensitive."))
+                raise forms.ValidationError(self.error_messages['invalid_login'])
             elif not self.user_cache.is_active:
-                raise forms.ValidationError(_("This account is inactive."))
+                raise forms.ValidationError(self.error_messages['inactive'])
         self.check_for_test_cookie()
         return self.cleaned_data
 
     def check_for_test_cookie(self):
         if self.request and not self.request.session.test_cookie_worked():
-            raise forms.ValidationError(
-                _("Your Web browser doesn't appear to have cookies enabled. "
-                  "Cookies are required for logging in."))
+            raise forms.ValidationError(self.error_messages['nocookies'])
 
     def get_user_id(self):
         if self.user_cache:
@@ -148,7 +157,12 @@
         return self.user_cache
 
 class PasswordResetForm(forms.Form):
-    email = forms.EmailField(label=_("E-mail"), max_length=75)
+    email = forms.EmailField(label=_("E-mail"), max_length=75,
+                error_messages={
+                    'unknown': _("That e-mail address doesn't have an associated user account. "
+                                 "Are you sure you've registered?"),
+                    'unusable': _("The user account associated with this e-mail address cannot reset the password."),
+                })
 
     def clean_email(self):
         """
@@ -159,9 +173,9 @@
                                 email__iexact=email,
                                 is_active=True)
         if not len(self.users_cache):
-            raise forms.ValidationError(_("That e-mail address doesn't have an associated user account. Are you sure you've registered?"))
+            raise forms.ValidationError(self.fields['email'].error_messages['unknown'])
         if any((user.password == UNUSABLE_PASSWORD) for user in self.users_cache):
-            raise forms.ValidationError(_("The user account associated with this e-mail address cannot reset the password."))
+            raise forms.ValidationError(self.fields['email'].error_messages['unusable'])
         return email
 
     def save(self, domain_override=None,
@@ -201,7 +215,9 @@
     entering the old password
     """
     new_password1 = forms.CharField(label=_("New password"), widget=forms.PasswordInput)
-    new_password2 = forms.CharField(label=_("New password confirmation"), widget=forms.PasswordInput)
+    new_password2 = forms.CharField(label=_("New password confirmation"),
+        widget=forms.PasswordInput,
+        error_messages={'mismatch': _("The two password fields didn't match."), })
 
     def __init__(self, user, *args, **kwargs):
         self.user = user
@@ -212,7 +228,7 @@
         password2 = self.cleaned_data.get('new_password2')
         if password1 and password2:
             if password1 != password2:
-                raise forms.ValidationError(_("The two password fields didn't match."))
+                raise forms.ValidationError(self.fields['new_password2'].error_messages['mismatch'])
         return password2
 
     def save(self, commit=True):
@@ -226,7 +242,8 @@
     A form that lets a user change his/her password by entering
     their old password.
     """
-    old_password = forms.CharField(label=_("Old password"), widget=forms.PasswordInput)
+    old_password = forms.CharField(label=_("Old password"), widget=forms.PasswordInput,
+        error_messages={'incorrect': _("Your old password was entered incorrectly. Please enter it again.")})
 
     def clean_old_password(self):
         """
@@ -234,7 +251,7 @@
         """
         old_password = self.cleaned_data["old_password"]
         if not self.user.check_password(old_password):
-            raise forms.ValidationError(_("Your old password was entered incorrectly. Please enter it again."))
+            raise forms.ValidationError(self.fields['old_password'].error_messages['incorrect'])
         return old_password
 PasswordChangeForm.base_fields.keyOrder = ['old_password', 'new_password1', 'new_password2']
 
diff -r b33d4705456a django/contrib/auth/tests/forms.py
--- a/django/contrib/auth/tests/forms.py	Fri Dec 09 23:16:56 2011 +0000
+++ b/django/contrib/auth/tests/forms.py	Sat Dec 10 14:55:24 2011 +0100
@@ -1,8 +1,10 @@
 from __future__ import with_statement
 import os
 from django.core import mail
+from django.forms.fields import Field, EmailField
 from django.contrib.auth.models import User
 from django.contrib.auth.forms import UserCreationForm, AuthenticationForm,  PasswordChangeForm, SetPasswordForm, UserChangeForm, PasswordResetForm
+from django.utils.encoding import force_unicode
 from django.test import TestCase
 
 
@@ -19,7 +21,7 @@
         form = UserCreationForm(data)
         self.assertFalse(form.is_valid())
         self.assertEqual(form["username"].errors,
-                         [u'A user with that username already exists.'])
+            [force_unicode(form.fields['username'].error_messages['duplicate']),])
 
     def test_invalid_data(self):
         data = {
@@ -30,8 +32,7 @@
         form = UserCreationForm(data)
         self.assertFalse(form.is_valid())
         self.assertEqual(form["username"].errors,
-                         [u'This value may contain only letters, numbers and @/./+/-/_ characters.'])
-
+            [force_unicode(form.fields['username'].error_messages['invalid']),])
 
     def test_password_verification(self):
         # The verification password is incorrect.
@@ -43,8 +44,7 @@
         form = UserCreationForm(data)
         self.assertFalse(form.is_valid())
         self.assertEqual(form["password2"].errors,
-                         [u"The two password fields didn't match."])
-
+            [force_unicode(form.fields['password2'].error_messages['mismatch']),])
 
     def test_both_passwords(self):
         # One (or both) passwords weren't given
@@ -52,16 +52,15 @@
         form = UserCreationForm(data)
         self.assertFalse(form.is_valid())
         self.assertEqual(form['password1'].errors,
-                         [u'This field is required.'])
+            [force_unicode(Field.default_error_messages['required']),])
         self.assertEqual(form['password2'].errors,
-                         [u'This field is required.'])
-
+            [force_unicode(Field.default_error_messages['required']),])
 
         data['password2'] = 'test123'
         form = UserCreationForm(data)
         self.assertFalse(form.is_valid())
         self.assertEqual(form['password1'].errors,
-                         [u'This field is required.'])
+            [force_unicode(Field.default_error_messages['required']),])
 
     def test_success(self):
         # The success case.
@@ -91,7 +90,7 @@
         form = AuthenticationForm(None, data)
         self.assertFalse(form.is_valid())
         self.assertEqual(form.non_field_errors(),
-                         [u'Please enter a correct username and password. Note that both fields are case-sensitive.'])
+            [force_unicode(form.error_messages['invalid_login']),])
 
     def test_inactive_user(self):
         # The user is inactive.
@@ -102,8 +101,7 @@
         form = AuthenticationForm(None, data)
         self.assertFalse(form.is_valid())
         self.assertEqual(form.non_field_errors(),
-                         [u'This account is inactive.'])
-
+            [force_unicode(form.error_messages['inactive']),])
 
     def test_success(self):
         # The success case
@@ -130,7 +128,7 @@
         form = SetPasswordForm(user, data)
         self.assertFalse(form.is_valid())
         self.assertEqual(form["new_password2"].errors,
-                         [u"The two password fields didn't match."])
+            [force_unicode(form.fields['new_password2'].error_messages['mismatch']),])
 
     def test_success(self):
         user = User.objects.get(username='testclient')
@@ -156,8 +154,7 @@
         form = PasswordChangeForm(user, data)
         self.assertFalse(form.is_valid())
         self.assertEqual(form["old_password"].errors,
-                         [u'Your old password was entered incorrectly. Please enter it again.'])
-
+            [force_unicode(form.fields['old_password'].error_messages['incorrect']),])
 
     def test_password_verification(self):
         # The two new passwords do not match.
@@ -170,8 +167,7 @@
         form = PasswordChangeForm(user, data)
         self.assertFalse(form.is_valid())
         self.assertEqual(form["new_password2"].errors,
-                         [u"The two password fields didn't match."])
-
+            [force_unicode(form.fields['new_password2'].error_messages['mismatch']),])
 
     def test_success(self):
         # The success case.
@@ -200,7 +196,7 @@
         form = UserChangeForm(data, instance=user)
         self.assertFalse(form.is_valid())
         self.assertEqual(form['username'].errors,
-                         [u'This value may contain only letters, numbers and @/./+/-/_ characters.'])
+            [force_unicode(form.fields['username'].error_messages['invalid']),])
 
     def test_bug_14242(self):
         # A regression test, introduce by adding an optimization for the
@@ -236,7 +232,7 @@
         form = PasswordResetForm(data)
         self.assertFalse(form.is_valid())
         self.assertEqual(form['email'].errors,
-                         [u'Enter a valid e-mail address.'])
+            [force_unicode(EmailField.default_error_messages['invalid']),])
 
     def test_nonexistant_email(self):
         # Test nonexistant email address
@@ -244,7 +240,7 @@
         form = PasswordResetForm(data)
         self.assertFalse(form.is_valid())
         self.assertEqual(form.errors,
-                         {'email': [u"That e-mail address doesn't have an associated user account. Are you sure you've registered?"]})
+            {'email': [force_unicode(form.fields['email'].error_messages['unknown']),]})
 
     def test_cleaned_data(self):
         # Regression test
diff -r b33d4705456a django/contrib/auth/tests/views.py
--- a/django/contrib/auth/tests/views.py	Fri Dec 09 23:16:56 2011 +0000
+++ b/django/contrib/auth/tests/views.py	Sat Dec 10 14:55:24 2011 +0100
@@ -5,15 +5,21 @@
 
 from django.conf import settings
 from django.contrib.auth import SESSION_KEY, REDIRECT_FIELD_NAME
-from django.contrib.auth.forms import AuthenticationForm
+from django.contrib.auth.forms import (AuthenticationForm, PasswordChangeForm,
+                SetPasswordForm, AuthenticationForm, PasswordResetForm, )
 from django.contrib.sites.models import Site, RequestSite
 from django.contrib.auth.models import User
 from django.core.urlresolvers import NoReverseMatch
+from django.utils.html import escape
+from django.utils.encoding import force_unicode
 from django.test import TestCase
 from django.core import mail
 from django.core.urlresolvers import reverse
 from django.http import QueryDict
 
+def _escape(proxy):
+    """Force proxy to unicode and escape"""
+    return escape(force_unicode(proxy))
 
 class AuthViewsTestCase(TestCase):
     """
@@ -80,7 +86,7 @@
         response = self.client.get('/password_reset/')
         self.assertEqual(response.status_code, 200)
         response = self.client.post('/password_reset/', {'email': 'not_a_real_email@email.com'})
-        self.assertContains(response, "That e-mail address doesn&#39;t have an associated user account")
+        self.assertContains(response, _escape(PasswordResetForm.base_fields['email'].error_messages['unknown']))
         self.assertEqual(len(mail.outbox), 0)
 
     def test_email_found(self):
@@ -171,7 +177,7 @@
         response = self.client.post(path, {'new_password1': 'anewpassword',
                                            'new_password2':' x'})
         self.assertEqual(response.status_code, 200)
-        self.assertTrue("The two password fields didn&#39;t match" in response.content)
+        self.assertTrue(_escape(SetPasswordForm.base_fields['new_password2'].error_messages['mismatch']) in response.content)
 
 class ChangePasswordTest(AuthViewsTestCase):
 
@@ -182,7 +188,7 @@
             }
         )
         self.assertEqual(response.status_code, 200)
-        self.assertTrue("Please enter a correct username and password. Note that both fields are case-sensitive." in response.content)
+        self.assertTrue(_escape(AuthenticationForm.error_messages['invalid_login']) in response.content)
 
     def logout(self):
         response = self.client.get('/logout/')
@@ -196,7 +202,7 @@
             }
         )
         self.assertEqual(response.status_code, 200)
-        self.assertTrue("Your old password was entered incorrectly. Please enter it again." in response.content)
+        self.assertTrue(_escape(PasswordChangeForm.base_fields['old_password'].error_messages['incorrect']) in response.content)
 
     def test_password_change_fails_with_mismatched_passwords(self):
         self.login()
@@ -207,7 +213,7 @@
             }
         )
         self.assertEqual(response.status_code, 200)
-        self.assertTrue("The two password fields didn&#39;t match." in response.content)
+        self.assertTrue(_escape(SetPasswordForm.base_fields['new_password2'].error_messages['mismatch']) in response.content)
 
     def test_password_change_succeeds(self):
         self.login()
