diff --git a/business/auth2/auth2.go b/business/auth2/auth2.go index 250a05fb7..623190bfc 100644 --- a/business/auth2/auth2.go +++ b/business/auth2/auth2.go @@ -71,7 +71,7 @@ type IAuther interface { // 负责验证secret,并找到相应的用户返回(password,email,mobile类型的不负责用户查找)如果找不到用户UserID为空 VerifySecret(authID, authSecret string) (authBindEx *AuthBindEx, err error) AddAuthBind(authBindEx *AuthBindEx, userName string) (err error) - UnbindAuth(authInfo *AuthInfo, authType string) (err error) + UnbindAuth(userID, authType, userName string) (err error) Logout(authInfo *AuthInfo) (err error) } @@ -277,9 +277,9 @@ func AddAuthBind(user IUser, newAuthInfo *AuthInfo) (err error) { return err } -func UnbindAuth(authInfo *AuthInfo, authType string) (err error) { +func UnbindAuth(userID, authType, userName string) (err error) { if handler := authers[authType]; handler != nil { - err = handler.UnbindAuth(authInfo, authType) + err = handler.UnbindAuth(userID, authType, userName) } else { err = ErrIllegalAuthType } diff --git a/business/auth2/authprovider/defauther.go b/business/auth2/authprovider/defauther.go index 599a4393e..bfe816ba3 100644 --- a/business/auth2/authprovider/defauther.go +++ b/business/auth2/authprovider/defauther.go @@ -35,9 +35,9 @@ func (a *DefAuther) AddAuthBind(authBindEx *auth2.AuthBindEx, userName string) ( return err } -func (a *DefAuther) UnbindAuth(authInfo *auth2.AuthInfo, authType string) (err error) { - _, err = dao.DeleteEntityLogically(nil, &model.AuthBind{}, nil, authInfo.GetID(), map[string]interface{}{ - "UserID": authInfo.GetID(), +func (a *DefAuther) UnbindAuth(userID, authType, userName string) (err error) { + _, err = dao.DeleteEntityLogically(nil, &model.AuthBind{}, nil, userName, map[string]interface{}{ + "UserID": userID, "Type": authType, model.FieldDeletedAt: utils.DefaultTimeValue, }) diff --git a/business/auth2/authprovider/mobile/mobile.go b/business/auth2/authprovider/mobile/mobile.go index 27c246ca7..e4d9efff2 100644 --- a/business/auth2/authprovider/mobile/mobile.go +++ b/business/auth2/authprovider/mobile/mobile.go @@ -83,6 +83,6 @@ func (a *Auther) AddAuthBind(authBindEx *auth2.AuthBindEx, userName string) (err } // 此函数为空 -func (a *Auther) UnbindAuth(authInfo *auth2.AuthInfo, authType string) (err error) { +func (a *Auther) UnbindAuth(userID, authType, userName string) (err error) { return err } diff --git a/controllers/auth2.go b/controllers/auth2.go index bc53945fd..23e3e3d3a 100644 --- a/controllers/auth2.go +++ b/controllers/auth2.go @@ -248,7 +248,7 @@ func (c *Auth2Controller) RemoveAuthBind() { c.callRemoveAuthBind(func(params *tAuth2RemoveAuthBindParams) (retVal interface{}, errCode string, err error) { authInfo, err2 := params.Ctx.GetV2AuthInfo() if err = err2; err == nil { - err = auth2.UnbindAuth(authInfo, params.AuthType) + err = auth2.UnbindAuth(authInfo.GetID(), params.AuthType, params.Ctx.GetUserName()) } return retVal, "", err })