fixed #2731: updated password change form to allow translation

git-svn-id: http://code.djangoproject.com/svn/django/trunk@3828 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Georg Bauer 2006-09-25 13:53:41 +00:00
parent 0d24c93b34
commit 182b5c5b5c
1 changed files with 3 additions and 3 deletions

View File

@ -81,7 +81,7 @@ class PasswordResetForm(forms.Manipulator):
try: try:
self.user_cache = User.objects.get(email__iexact=new_data) self.user_cache = User.objects.get(email__iexact=new_data)
except User.DoesNotExist: except User.DoesNotExist:
raise validators.ValidationError, "That e-mail address doesn't have an associated user acount. Are you sure you've registered?" raise validators.ValidationError, _("That e-mail address doesn't have an associated user acount. Are you sure you've registered?")
def save(self, domain_override=None, email_template_name='registration/password_reset_email.html'): def save(self, domain_override=None, email_template_name='registration/password_reset_email.html'):
"Calculates a new password randomly and sends it to the user" "Calculates a new password randomly and sends it to the user"
@ -113,14 +113,14 @@ class PasswordChangeForm(forms.Manipulator):
forms.PasswordField(field_name="old_password", length=30, maxlength=30, is_required=True, forms.PasswordField(field_name="old_password", length=30, maxlength=30, is_required=True,
validator_list=[self.isValidOldPassword]), validator_list=[self.isValidOldPassword]),
forms.PasswordField(field_name="new_password1", length=30, maxlength=30, is_required=True, forms.PasswordField(field_name="new_password1", length=30, maxlength=30, is_required=True,
validator_list=[validators.AlwaysMatchesOtherField('new_password2', "The two 'new password' fields didn't match.")]), validator_list=[validators.AlwaysMatchesOtherField('new_password2', _("The two 'new password' fields didn't match."))]),
forms.PasswordField(field_name="new_password2", length=30, maxlength=30, is_required=True), forms.PasswordField(field_name="new_password2", length=30, maxlength=30, is_required=True),
) )
def isValidOldPassword(self, new_data, all_data): def isValidOldPassword(self, new_data, all_data):
"Validates that the old_password field is correct." "Validates that the old_password field is correct."
if not self.user.check_password(new_data): if not self.user.check_password(new_data):
raise validators.ValidationError, "Your old password was entered incorrectly. Please enter it again." raise validators.ValidationError, _("Your old password was entered incorrectly. Please enter it again.")
def save(self, new_data): def save(self, new_data):
"Saves the new password." "Saves the new password."