File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11from __future__ import unicode_literals
22
3- from django import forms , VERSION
3+ from django import forms
44from django .contrib .auth .forms import (
55 ReadOnlyPasswordHashWidget ,
66 PasswordResetForm as OldPasswordResetForm ,
77 UserChangeForm as DjangoUserChangeForm ,
88 AuthenticationForm as DjangoAuthenticationForm ,
99)
1010from django .contrib .auth import get_user_model , password_validation
11- from django .contrib .auth .hashers import UNUSABLE_PASSWORD_PREFIX
1211from django .utils .translation import gettext_lazy as _
1312
1413User = get_user_model ()
1514
1615
17- def is_password_usable (pw ):
18- """Decide whether a password is usable only by the unusable password prefix.
19-
20- We can't use django.contrib.auth.hashers.is_password_usable either, because
21- it not only checks against the unusable password, but checks for a valid
22- hasher too. We need different error messages in those cases.
23- """
24-
25- return not pw .startswith (UNUSABLE_PASSWORD_PREFIX )
26-
27-
2816class BetterReadOnlyPasswordHashWidget (ReadOnlyPasswordHashWidget ):
2917 """
3018 A ReadOnlyPasswordHashWidget that has a less intimidating output.
You can’t perform that action at this time.
0 commit comments