- set correct authIDType when calling auth2.Login

This commit is contained in:
gazebo
2019-03-04 17:50:16 +08:00
parent 3e79e8a99b
commit 083f9ccbcf
3 changed files with 11 additions and 4 deletions

View File

@@ -44,7 +44,7 @@ func RegisterUser(user *model.User, mobileVerifyCode string, inAuthInfo *auth2.A
if user == nil || user.UserID2 == "" || user.Name == "" || user.Mobile == "" {
return nil, model.ErrCodeGeneralFailed, ErrUserIDAndNameMustGiven
}
mobileAuth, err2 := auth2.Login(auth2.AuthTypeMobile, user.Mobile, auth2.UserIDNone, mobileVerifyCode)
mobileAuth, err2 := auth2.Login(auth2.AuthTypeMobile, user.Mobile, auth2.UserIDMobile, mobileVerifyCode)
if err = err2; err == nil {
if mobileAuth.IUser != nil {
return nil, model.ErrCodeUserAlreadyExist, auth2.ErrUserMobileAlreadyExist
@@ -78,7 +78,7 @@ func GetUserBindAuthInfo(ctx *jxcontext.Context) (authList []*model.AuthBind, er
func ChangeMobile2(ctx *jxcontext.Context, mobile, mobileVerifyCode string) (err error) {
authInfo, err := ctx.GetV2AuthInfo()
if err == nil {
mobileAuth, err2 := auth2.Login(auth2.AuthTypeMobile, mobile, auth2.UserIDNone, mobileVerifyCode)
mobileAuth, err2 := auth2.Login(auth2.AuthTypeMobile, mobile, auth2.UserIDMobile, mobileVerifyCode)
if err = err2; err == nil {
if mobileAuth.IUser != nil && authInfo.GetID() != mobileAuth.GetID() {
return errors.New("手机号已经存在")