上一篇我们实现了用户的登录和注销模块,本篇我们将实现用户自己修改密码。
同样地,我们首先在forms.py创建修改密码的表单如下:
class ChangepwdForm(forms.Form):
oldpassword = forms.CharField(
required=True,
label=u"原密码",
error_messages={'required': u'请输入原密码'},
widget=forms.PasswordInput(
attrs={
'placeholder':u"原密码",
}
),
)
newpassword1 = forms.CharField(
required=True,
label=u"新密码",
error_messages={'required': u'请输入新密码'},
widget=forms.PasswordInput(
attrs={
'placeholder':u"新密码",
}
),
)
newpassword2 = forms.CharField(
required=True,
label=u"确认密码",
error_messages={'required': u'请再次输入新密码'},
widg