diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 617bcc6cd..f8c52b26e 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -240,7 +240,6 @@ func Login(authType, authID, authIDType, authSecret string) (authInfo *AuthInfo, } if authBindEx, err = handler.VerifySecret(realAuthID, authSecret); err == nil { // globals.SugarLogger.Debugf("auth2 Login authBindEx:%s", utils.Format4Output(authBindEx, false)) - needAutoAddAuthBind := false if authBindEx == nil { // mobile, email会返回nil(表示不会新建AuthBind实体) user = userProvider.GetUser(authID, authIDType) authBindEx = &AuthBindEx{ @@ -261,21 +260,12 @@ func Login(authType, authID, authIDType, authSecret string) (authInfo *AuthInfo, } if user != nil { authBindEx.UserID = user.GetID() - needAutoAddAuthBind = true } } else if authBindEx.UserID != "" { user = userProvider.GetUser(authBindEx.UserID, UserIDID) } } authInfo = createAuthInfo(user, authBindEx) - if needAutoAddAuthBind { - if authers[authInfo.AuthBindInfo.Type].UnbindAuth(user.GetID(), authInfo.GetAuthType(), user.GetName()) == nil { - if authers[authInfo.AuthBindInfo.Type].AddAuthBind(authInfo.AuthBindInfo, user.GetName()) == nil { - // todo,用户类型应该要与RegisterUser一起统一处理 - userProvider.UpdateUserType(user.GetID(), handler.GetUserType(), UpdateUserTypeAdd) - } - } - } } } else { err = ErrIllegalAuthType @@ -318,6 +308,7 @@ func AddAuthBind(user IUser, newAuthInfo *AuthInfo) (err error) { err = userProvider.UpdateUserEmail(user.GetID(), newAuthInfo.AuthBindInfo.AuthID) } else { newAuthInfo.AuthBindInfo.UserID = user.GetID() + authers[newAuthInfo.AuthBindInfo.Type].UnbindAuth(user.GetID(), newAuthInfo.GetAuthType(), user.GetName()) err = authers[newAuthInfo.AuthBindInfo.Type].AddAuthBind(newAuthInfo.AuthBindInfo, user.GetName()) } return err