...
|
...
|
@@ -68,6 +68,9 @@ func ResetPassword(header *protocol.RequestHeader, request *protocol.ResetPasswo |
|
|
if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) {
|
|
|
err = protocol.NewErrWithMessage(2026)
|
|
|
}
|
|
|
if len(request.NewPwd)<6 {
|
|
|
err = protocol.NewErrWithMessage(2027)
|
|
|
}
|
|
|
err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Passwd": request.NewPwd})
|
|
|
return
|
|
|
}
|
...
|
...
|
@@ -78,15 +81,18 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass |
|
|
user *models.User
|
|
|
)
|
|
|
//rsp =&protocol.ChangePasswordResponse{}
|
|
|
if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) {
|
|
|
err = protocol.NewErrWithMessage(2026)
|
|
|
}
|
|
|
if len(request.NewPwd)<6 {
|
|
|
err = protocol.NewErrWithMessage(2027)
|
|
|
}
|
|
|
if user, err = repository.User.GetUsersById(header.Uid); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
if strings.EqualFold(request.OldPwd, user.Passwd) {
|
|
|
err = protocol.NewErrWithMessage(1)
|
|
|
}
|
|
|
if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) {
|
|
|
err = protocol.NewErrWithMessage(2026)
|
|
|
if !strings.EqualFold(request.OldPwd, user.Passwd) {
|
|
|
err = protocol.NewErrWithMessage(2028)
|
|
|
}
|
|
|
err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Passwd": request.NewPwd})
|
|
|
return
|
...
|
...
|
|