diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 25ee10c06..617bcc6cd 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -269,9 +269,11 @@ func Login(authType, authID, authIDType, authSecret string) (authInfo *AuthInfo, } authInfo = createAuthInfo(user, authBindEx) if needAutoAddAuthBind { - if authers[authInfo.AuthBindInfo.Type].AddAuthBind(authInfo.AuthBindInfo, user.GetName()) == nil { - // todo,用户类型应该要与RegisterUser一起统一处理 - userProvider.UpdateUserType(user.GetID(), handler.GetUserType(), UpdateUserTypeAdd) + 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) + } } } }