...
|
...
|
@@ -25,7 +25,7 @@ func CheckSmsCode(header *protocol.RequestHeader, request *protocol.CheckSmsCode |
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
|
|
if result, err = auth.CheckSmsCode(user.Phone, request.Captcha, protocol.SmsCode); err != nil {
|
|
|
if result, err = auth.CheckSmsCode(strings.TrimSpace(user.Phone), request.Captcha, protocol.SmsCode); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
|
|
}
|
...
|
...
|
@@ -50,10 +50,10 @@ func ChangePhone(header *protocol.RequestHeader, request *protocol.ChangePhoneRe |
|
|
return
|
|
|
}
|
|
|
//判断库里面是否已经有这个手机号的用户
|
|
|
//if _, err = repository.User.GetUsersByMobile(request.Phone); err == nil {
|
|
|
// err = protocol.NewErrWithMessage(2029)
|
|
|
// return
|
|
|
//}
|
|
|
if _, err = models.GetUserByMobile(request.Phone); err == nil {
|
|
|
err = protocol.NewErrWithMessage(2029)
|
|
|
return
|
|
|
}
|
|
|
if !result {
|
|
|
err = protocol.NewErrWithMessage(1012)
|
|
|
return
|
...
|
...
|
@@ -85,7 +85,7 @@ func ResetPassword(header *protocol.RequestHeader, request *protocol.ResetPasswo |
|
|
user *models.User
|
|
|
message *protocol.Message
|
|
|
getUserRequest *protocol.UCenterGetUserRequest = &protocol.UCenterGetUserRequest{}
|
|
|
getUserResponse *protocol.UCenterGetUserResponse
|
|
|
getUserResponse *protocol.UCenter_GetUserResponse
|
|
|
result bool
|
|
|
)
|
|
|
if len(request.NewPwd) < 6 {
|
...
|
...
|
@@ -117,6 +117,7 @@ func ResetPassword(header *protocol.RequestHeader, request *protocol.ResetPasswo |
|
|
} else {
|
|
|
err = protocol.NewErrWithMessage(1)
|
|
|
log.Error("用户中心获取数据失败: err_no:%v msg:%v", message.Errno, message.Errmsg)
|
|
|
return
|
|
|
}
|
|
|
if getUserResponse.Id != user.UserCenterId {
|
|
|
err = protocol.NewErrWithMessage(1)
|
...
|
...
|
@@ -152,8 +153,10 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass |
|
|
}
|
|
|
var message protocol.Message
|
|
|
if _, err = agg.RequestUserCenter(protocol.MethodLogin, http.MethodPost, &protocol.UCenterLoginRequest{
|
|
|
PassWord: request.OldPwd,
|
|
|
Phone: user.Phone,
|
|
|
PassWord: request.OldPwd,
|
|
|
Phone: user.Phone,
|
|
|
Type: 1,
|
|
|
GrantType: protocol.LoginTypePassPord,
|
|
|
}, &message); err != nil {
|
|
|
log.Error(err)
|
|
|
return
|
...
|
...
|
|