...
|
...
|
@@ -47,11 +47,14 @@ func ChangePhone(header *protocol.RequestHeader, request *protocol.ChangePhoneRe |
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
//TODO:跟用户中心交换数据
|
|
|
if _, err = repository.User.GetUsersByMobile(request.Phone); err == nil {
|
|
|
err = protocol.NewErrWithMessage(2029)
|
|
|
return
|
|
|
}
|
|
|
if !result {
|
|
|
err = protocol.NewErrWithMessage(1012)
|
|
|
return
|
|
|
}
|
|
|
err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Phone": request.Phone})
|
|
|
return
|
...
|
...
|
@@ -70,9 +73,11 @@ func ResetPassword(header *protocol.RequestHeader, request *protocol.ResetPasswo |
|
|
//TODO:未验证 校验码
|
|
|
if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) {
|
|
|
err = protocol.NewErrWithMessage(2026)
|
|
|
return
|
|
|
}
|
|
|
if len(request.NewPwd) < 6 {
|
|
|
err = protocol.NewErrWithMessage(2027)
|
|
|
return
|
|
|
}
|
|
|
err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Passwd": request.NewPwd})
|
|
|
return
|
...
|
...
|
@@ -86,9 +91,11 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass |
|
|
//rsp =&protocol.ChangePasswordResponse{}
|
|
|
if !strings.EqualFold(request.NewPwd, request.ConfirmPwd) {
|
|
|
err = protocol.NewErrWithMessage(2026)
|
|
|
return
|
|
|
}
|
|
|
if len(request.NewPwd) < 6 {
|
|
|
err = protocol.NewErrWithMessage(2027)
|
|
|
return
|
|
|
}
|
|
|
if user, err = repository.User.GetUsersById(header.Uid); err != nil {
|
|
|
log.Error(err)
|
...
|
...
|
@@ -96,6 +103,7 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass |
|
|
}
|
|
|
if !strings.EqualFold(request.OldPwd, user.Passwd) {
|
|
|
err = protocol.NewErrWithMessage(2028)
|
|
|
return
|
|
|
}
|
|
|
err = utils.UpdateTableByMap(&models.User{Id: user.Id}, map[string]interface{}{"Passwd": request.NewPwd})
|
|
|
return
|
...
|
...
|
|