18.4. 修改密码
说明
这节课我们来创建『修改密码』接口。
修改密码需要用户输入原来的密码,进行登录验证,原来的密码正确的话,才能执行更新操作。
1. 创建验证器
app/requests/user_request.go
.
.
.
type UserUpdatePasswordRequest struct {
Password string `valid:"password" json:"password,omitempty"`
NewPassword string `valid:"new_password" json:"new_password,omitempty"`
NewPasswordConfirm string