|
@@ -25,7 +25,7 @@ func CheckSmsCode(header *protocol.RequestHeader, request *protocol.CheckSmsCode |
|
@@ -25,7 +25,7 @@ func CheckSmsCode(header *protocol.RequestHeader, request *protocol.CheckSmsCode |
25
|
log.Error(err)
|
25
|
log.Error(err)
|
26
|
return
|
26
|
return
|
27
|
}
|
27
|
}
|
28
|
- if result, err = auth.CheckSmsCode(user.Phone, request.Captcha, protocol.SmsCode); err != nil {
|
28
|
+ if result, err = auth.CheckSmsCode(strings.TrimSpace(user.Phone), request.Captcha, protocol.SmsCode); err != nil {
|
29
|
log.Error(err)
|
29
|
log.Error(err)
|
30
|
return
|
30
|
return
|
31
|
}
|
31
|
}
|
|
@@ -50,10 +50,10 @@ func ChangePhone(header *protocol.RequestHeader, request *protocol.ChangePhoneRe |
|
@@ -50,10 +50,10 @@ func ChangePhone(header *protocol.RequestHeader, request *protocol.ChangePhoneRe |
50
|
return
|
50
|
return
|
51
|
}
|
51
|
}
|
52
|
//判断库里面是否已经有这个手机号的用户
|
52
|
//判断库里面是否已经有这个手机号的用户
|
53
|
- //if _, err = repository.User.GetUsersByMobile(request.Phone); err == nil {
|
|
|
54
|
- // err = protocol.NewErrWithMessage(2029)
|
|
|
55
|
- // return
|
|
|
56
|
- //}
|
53
|
+ if _, err = models.GetUserByMobile(request.Phone); err == nil {
|
|
|
54
|
+ err = protocol.NewErrWithMessage(2029)
|
|
|
55
|
+ return
|
|
|
56
|
+ }
|
57
|
if !result {
|
57
|
if !result {
|
58
|
err = protocol.NewErrWithMessage(1012)
|
58
|
err = protocol.NewErrWithMessage(1012)
|
59
|
return
|
59
|
return
|
|
@@ -85,7 +85,7 @@ func ResetPassword(header *protocol.RequestHeader, request *protocol.ResetPasswo |
|
@@ -85,7 +85,7 @@ func ResetPassword(header *protocol.RequestHeader, request *protocol.ResetPasswo |
85
|
user *models.User
|
85
|
user *models.User
|
86
|
message *protocol.Message
|
86
|
message *protocol.Message
|
87
|
getUserRequest *protocol.UCenterGetUserRequest = &protocol.UCenterGetUserRequest{}
|
87
|
getUserRequest *protocol.UCenterGetUserRequest = &protocol.UCenterGetUserRequest{}
|
88
|
- getUserResponse *protocol.UCenterGetUserResponse
|
88
|
+ getUserResponse *protocol.UCenter_GetUserResponse
|
89
|
result bool
|
89
|
result bool
|
90
|
)
|
90
|
)
|
91
|
if len(request.NewPwd) < 6 {
|
91
|
if len(request.NewPwd) < 6 {
|
|
@@ -117,6 +117,7 @@ func ResetPassword(header *protocol.RequestHeader, request *protocol.ResetPasswo |
|
@@ -117,6 +117,7 @@ func ResetPassword(header *protocol.RequestHeader, request *protocol.ResetPasswo |
117
|
} else {
|
117
|
} else {
|
118
|
err = protocol.NewErrWithMessage(1)
|
118
|
err = protocol.NewErrWithMessage(1)
|
119
|
log.Error("用户中心获取数据失败: err_no:%v msg:%v", message.Errno, message.Errmsg)
|
119
|
log.Error("用户中心获取数据失败: err_no:%v msg:%v", message.Errno, message.Errmsg)
|
|
|
120
|
+ return
|
120
|
}
|
121
|
}
|
121
|
if getUserResponse.Id != user.UserCenterId {
|
122
|
if getUserResponse.Id != user.UserCenterId {
|
122
|
err = protocol.NewErrWithMessage(1)
|
123
|
err = protocol.NewErrWithMessage(1)
|
|
@@ -152,8 +153,10 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass |
|
@@ -152,8 +153,10 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass |
152
|
}
|
153
|
}
|
153
|
var message protocol.Message
|
154
|
var message protocol.Message
|
154
|
if _, err = agg.RequestUserCenter(protocol.MethodLogin, http.MethodPost, &protocol.UCenterLoginRequest{
|
155
|
if _, err = agg.RequestUserCenter(protocol.MethodLogin, http.MethodPost, &protocol.UCenterLoginRequest{
|
155
|
- PassWord: request.OldPwd,
|
|
|
156
|
- Phone: user.Phone,
|
156
|
+ PassWord: request.OldPwd,
|
|
|
157
|
+ Phone: user.Phone,
|
|
|
158
|
+ Type: 1,
|
|
|
159
|
+ GrantType: protocol.LoginTypePassPord,
|
157
|
}, &message); err != nil {
|
160
|
}, &message); err != nil {
|
158
|
log.Error(err)
|
161
|
log.Error(err)
|
159
|
return
|
162
|
return
|