...
|
...
|
@@ -351,10 +351,12 @@ func CenterCompanys(header *protocol.RequestHeader, request *protocolx.CenterCom |
|
|
break
|
|
|
case protocol.LoginByCredentials:
|
|
|
//凭证是否存在
|
|
|
if credential, e := userAuth.NewRedisUserCredential(request.Phone).GetAuth(); e != nil || !strings.EqualFold(credential, request.Credentials) {
|
|
|
log.Debug("凭证过期或者已失效:", request.Phone)
|
|
|
err = protocol.NewErrWithMessage(4140, err)
|
|
|
return
|
|
|
if constant.DISENABLE_MULTI_DEVICE_LOGIN {
|
|
|
if credential, e := userAuth.NewRedisUserCredential(request.Phone).GetAuth(); e != nil || !strings.EqualFold(credential, request.Credentials) {
|
|
|
log.Debug("凭证过期或者已失效:", request.Phone)
|
|
|
err = protocol.NewErrWithMessage(4140, err)
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
if _, err = utils.ParseJWTToken(request.Credentials); err != nil {
|
|
|
err = protocol.NewErrWithMessage(4140, err)
|
...
|
...
|
@@ -419,10 +421,12 @@ func Companys(header *protocol.RequestHeader, request *protocolx.CompanysRequest |
|
|
return
|
|
|
}
|
|
|
//凭证是否存在
|
|
|
if credential, e := userAuth.NewRedisUserCredential(claim.Phone).GetAuth(); e != nil || !strings.EqualFold(credential, request.Credentials) {
|
|
|
log.Debug("凭证过期或者已失效:", claim.Phone)
|
|
|
err = protocol.NewErrWithMessage(4140, err)
|
|
|
return
|
|
|
if constant.DISENABLE_MULTI_DEVICE_LOGIN {
|
|
|
if credential, e := userAuth.NewRedisUserCredential(claim.Phone).GetAuth(); e != nil || !strings.EqualFold(credential, request.Credentials) {
|
|
|
log.Debug("凭证过期或者已失效:", claim.Phone)
|
|
|
err = protocol.NewErrWithMessage(4140, err)
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
loginSvr.Init(claim.Phone)
|
|
|
rsp.Partner, _ = loginSvr.PartnerStaticInfo()
|
...
|
...
|
@@ -458,11 +462,13 @@ func LoginV2(header *protocol.RequestHeader, request *protocol.LoginRequestV2) ( |
|
|
err = protocol.NewErrWithMessage(4140, err)
|
|
|
return
|
|
|
}
|
|
|
//凭证是否存在
|
|
|
if credential, e := userAuth.NewRedisUserCredential(claim.Phone).GetAuth(); e != nil || !strings.EqualFold(credential, request.Credentials) {
|
|
|
log.Debug("凭证过期或者已失效:", claim.Phone)
|
|
|
err = protocol.NewErrWithMessage(4140, err)
|
|
|
return
|
|
|
if constant.DISENABLE_MULTI_DEVICE_LOGIN {
|
|
|
//凭证是否存在
|
|
|
if credential, e := userAuth.NewRedisUserCredential(claim.Phone).GetAuth(); e != nil || !strings.EqualFold(credential, request.Credentials) {
|
|
|
log.Debug("凭证过期或者已失效:", claim.Phone)
|
|
|
err = protocol.NewErrWithMessage(4140, err)
|
|
|
return
|
|
|
}
|
|
|
}
|
|
|
if company, e := CompanyRepository.FindOne(map[string]interface{}{"id": request.Cid, "enable": 1}); e != nil || company == nil {
|
|
|
err = protocol.NewErrWithMessage(10007, err)
|
...
|
...
|
|