From e4f18123373e1cbf223ca1d6eaae8f05b857f71a Mon Sep 17 00:00:00 2001 From: gazebo Date: Mon, 2 Sep 2019 14:53:18 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E7=BB=91=E5=AE=9A=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=E5=89=8D=EF=BC=8C=E5=85=88=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E7=9A=84=E7=9B=B8=E5=90=8C=E7=9A=84=E8=AE=A4?= =?UTF-8?q?=E8=AF=81=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/auth2/auth2.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) 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