- IAuther.UnbindAuth的接口改为userID

This commit is contained in:
gazebo
2019-08-13 11:02:14 +08:00
parent 37b931abe5
commit d59ca265c4
4 changed files with 8 additions and 8 deletions

View File

@@ -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
}

View File

@@ -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,
})

View File

@@ -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
}