Skip to content

Commit

Permalink
Fixed auth to not use an internal implementation detail of SortedDict
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Jul 14, 2012
1 parent 8f00286 commit 3e8d8bb
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions django/contrib/auth/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from django import forms
from django.forms.util import flatatt
from django.template import loader
from django.utils.datastructures import SortedDict
from django.utils.html import format_html, format_html_join
from django.utils.http import int_to_base36
from django.utils.safestring import mark_safe
Expand All @@ -14,6 +15,7 @@
from django.contrib.auth.tokens import default_token_generator
from django.contrib.sites.models import get_current_site


UNMASKED_DIGITS_TO_SHOW = 6

mask_password = lambda p: "%s%s" % (p[:UNMASKED_DIGITS_TO_SHOW], "*" * max(len(p) - UNMASKED_DIGITS_TO_SHOW, 0))
Expand Down Expand Up @@ -293,8 +295,11 @@ def clean_old_password(self):
raise forms.ValidationError(
self.error_messages['password_incorrect'])
return old_password
PasswordChangeForm.base_fields.keyOrder = ['old_password', 'new_password1',
'new_password2']

PasswordChangeForm.base_fields = SortedDict([
(k, PasswordChangeForm.base_fields[k])
for k in ['old_password', 'new_password1', 'new_password2']
])


class AdminPasswordChangeForm(forms.Form):
Expand Down

0 comments on commit 3e8d8bb

Please sign in to comment.