Skip to content

Commit

Permalink
Get the password help text from Django
Browse files Browse the repository at this point in the history
Django 1.8 and 1.9 use a different link, so just copy it from Django
instead of thinking about it. Fixes #62.
  • Loading branch information
gavinwahl committed Nov 16, 2015
1 parent e5fe701 commit d9beaaf
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions authtools/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from django import forms, VERSION as DJANGO_VERSION
from django.contrib.auth.forms import (
ReadOnlyPasswordHashField, ReadOnlyPasswordHashWidget,
PasswordResetForm as OldPasswordResetForm
PasswordResetForm as OldPasswordResetForm,
UserChangeForm as DjangoUserChangeForm,
)
from django.contrib.auth import get_user_model
from django.contrib.auth.hashers import identify_hasher
Expand Down Expand Up @@ -151,10 +152,8 @@ class AdminUserChangeForm(UserChangeForm):
def __init__(self, *args, **kwargs):
super(AdminUserChangeForm, self).__init__(*args, **kwargs)
if not self.fields['password'].help_text:
self.fields['password'].help_text = _(
"Raw passwords are not stored, so there is no way to see this"
" user's password, but you can change the password using"
" <a href=\"../password/\">this form</a>.")
self.fields['password'].help_text = \
DjangoUserChangeForm.base_fields['password'].help_text


class FriendlyPasswordResetForm(OldPasswordResetForm):
Expand Down

0 comments on commit d9beaaf

Please sign in to comment.