1
0
mirror of https://github.com/django/django.git synced 2025-10-26 23:26:08 +00:00

Fixed #3166 -- Added admin 'Change user password' view. Thanks for the patch, SmileyChris

git-svn-id: http://code.djangoproject.com/svn/django/trunk@4266 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty
2006-12-30 07:16:25 +00:00
parent 3abf868211
commit 7180207328
5 changed files with 105 additions and 3 deletions

View File

@@ -126,3 +126,18 @@ class PasswordChangeForm(oldforms.Manipulator):
"Saves the new password."
self.user.set_password(new_data['new_password1'])
self.user.save()
class AdminPasswordChangeForm(oldforms.Manipulator):
"A form used to change the password of a user in the admin interface."
def __init__(self, user):
self.user = user
self.fields = (
oldforms.PasswordField(field_name='password1', length=30, maxlength=60, is_required=True),
oldforms.PasswordField(field_name='password2', length=30, maxlength=60, is_required=True,
validator_list=[validators.AlwaysMatchesOtherField('password1', _("The two password fields didn't match."))]),
)
def save(self, new_data):
"Saves the new password."
self.user.set_password(new_data['password1'])
self.user.save()