作者 yangfu

user auth fix

... ... @@ -22,6 +22,7 @@ var errmessge ErrorMap = map[int]string{
2027: "密码必须至少有6个字符",
2028: "请输入正确的旧密码",
2029: "当前手机号已存在,请重新输入",
2030: "新密码与旧密码一致,请重新输入",
2060: "读取公告失败",
4139: "authCode无效或过期",
4140: "refreshToken过期,需要重新登录授权",
... ...
... ... @@ -20,10 +20,8 @@ type UCenterLoginRequest struct {
Code string `json:"code"`
GrantType string `json:"grantType" valid:"Required"`
//ClientId string `json:"clientId" valid:"Required"`
Type int `json:"typoe"` //1为密码登录,管理后台登录,2为token登录,app登录
Uid int64 `json:"uid"` // type2
Type int `json:"type"` //1为密码登录,管理后台登录,2为token登录,app登录
Uid int64 `json:"uid"` // type2
//CompanyId int64 `json:"companyId"` // type2
}
type UCenterLoginResponse struct {
... ...
... ... @@ -60,7 +60,7 @@ func RequestUserCenter(method string, httpMethod, request interface{}, rsponse i
} else {
response = string(data)
}
log.Debug("request ucenter:%v rsp:%v", url, response)
log.Debug(fmt.Sprintf("request ucenter:%v request:%v rsp:%v", url, request, response))
return
}
... ... @@ -80,6 +80,10 @@ func ChangeUcenterUserInfo(uid int64, phone string, user *protocol.UCenterPutUse
log.Error(err)
return
}
if message.Errno == -1 {
err = protocol.NewErrWithMessage(1)
return
}
if message.Errno != 0 {
err = protocol.NewErrWithMessage(1)
return
... ...
... ... @@ -143,6 +143,10 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass
err = protocol.NewErrWithMessage(2026)
return
}
if strings.EqualFold(request.NewPwd, request.OldPwd) {
err = protocol.NewErrWithMessage(2030)
return
}
if len(request.NewPwd) < 6 {
err = protocol.NewErrWithMessage(2027)
return
... ... @@ -171,7 +175,10 @@ func ChangePassword(header *protocol.RequestHeader, request *protocol.ChangePass
err = protocol.NewErrWithMessage(1)
return
}
err = agg.ChangeUcenterUserInfo(user.UserCenterId, user.Phone, &protocol.UCenterPutUserRequest{PassWord: request.NewPwd})
err = agg.ChangeUcenterUserInfo(user.UserCenterId, user.Phone, &protocol.UCenterPutUserRequest{
PassWord: request.NewPwd,
//Phone:user.Phone,
})
} else {
if message.Errno == -1 {
err = protocol.NewErrWithMessage(2028)
... ...