def __init__(self, *args, **kwargs): kwargs['active_tab'] = base_forms.AccountBaseForm.Tab.SIGNUP super().__init__(*args, **kwargs) self.fields['password1'] = account_forms.PasswordField( label=_("Password")) self.fields['password2'] = account_forms.PasswordField( label=_("Password (again)")) _customize_widgets(self)
class ChangePasswordForm(ChangePasswordMixin, allauth_forms.UserForm): oldpassword = allauth_forms.PasswordField(label=_("Current Password")) password = allauth_forms.SetPasswordField(label=_("New Password")) def clean_oldpassword(self): if not self.user.check_password(self.cleaned_data.get('oldpassword')): raise forms.ValidationError( _("Please type your current" " password.")) return self.cleaned_data['oldpassword']