use new password widget for password change (fixes #25045)
gitea/authentic/pipeline/head Build started... Details

This commit is contained in:
Benjamin Dauvergne 2018-07-20 00:29:55 +02:00 committed by Emmanuel Cazenave
parent e7fa8c906d
commit f59ebfc7a3
1 changed files with 6 additions and 9 deletions

View File

@ -19,7 +19,7 @@ from django.template.loader import render_to_string
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.core.validators import RegexValidator from django.core.validators import RegexValidator
from authentic2.forms.fields import NewPasswordField, CheckPasswordField from authentic2.forms.fields import PasswordField, NewPasswordField, CheckPasswordField
from .. import app_settings, compat, forms, utils, validators, models, middleware, hooks from .. import app_settings, compat, forms, utils, validators, models, middleware, hooks
from authentic2.a2_rbac.models import OrganizationalUnit from authentic2.a2_rbac.models import OrganizationalUnit
@ -164,10 +164,8 @@ class NotifyOfPasswordChange(object):
class SetPasswordForm(NotifyOfPasswordChange, PasswordResetMixin, auth_forms.SetPasswordForm): class SetPasswordForm(NotifyOfPasswordChange, PasswordResetMixin, auth_forms.SetPasswordForm):
new_password1 = CharField(label=_("New password"), new_password1 = NewPasswordField(label=_("New password"))
widget=PasswordInput, new_password2 = CheckPasswordField(label=_("New password confirmation"))
validators=[validators.validate_password],
help_text=validators.password_help_text())
def clean_new_password1(self): def clean_new_password1(self):
new_password1 = self.cleaned_data.get('new_password1') new_password1 = self.cleaned_data.get('new_password1')
@ -178,10 +176,9 @@ class SetPasswordForm(NotifyOfPasswordChange, PasswordResetMixin, auth_forms.Set
class PasswordChangeForm(NotifyOfPasswordChange, forms.NextUrlFormMixin, PasswordResetMixin, class PasswordChangeForm(NotifyOfPasswordChange, forms.NextUrlFormMixin, PasswordResetMixin,
auth_forms.PasswordChangeForm): auth_forms.PasswordChangeForm):
new_password1 = CharField(label=_("New password"), old_password = PasswordField(label=_('Old password'))
widget=PasswordInput, new_password1 = NewPasswordField(label=_('New password'))
validators=[validators.validate_password], new_password2 = CheckPasswordField(label=_("New password confirmation"))
help_text=validators.password_help_text())
def clean_new_password1(self): def clean_new_password1(self):
new_password1 = self.cleaned_data.get('new_password1') new_password1 = self.cleaned_data.get('new_password1')