- auth2.AddAuthBind的第一个参数从*AuthInfo改为IUser
This commit is contained in:
@@ -258,8 +258,8 @@ func BindUser(inauthInfo *AuthInfo, user IUser) (outauthInfo *AuthInfo, err erro
|
||||
}
|
||||
|
||||
// 添加新绑定
|
||||
func AddAuthBind(authInfo *AuthInfo, newAuthInfo *AuthInfo) (err error) {
|
||||
if authInfo == nil || newAuthInfo == nil {
|
||||
func AddAuthBind(user IUser, newAuthInfo *AuthInfo) (err error) {
|
||||
if user == nil || newAuthInfo == nil {
|
||||
return ErrInternalErrror
|
||||
}
|
||||
if !newAuthInfo.IsUserEmpty() {
|
||||
@@ -267,12 +267,12 @@ func AddAuthBind(authInfo *AuthInfo, newAuthInfo *AuthInfo) (err error) {
|
||||
}
|
||||
RemoveUserInfo(newAuthInfo.Token)
|
||||
if newAuthInfo.AuthBindInfo.Type == AuthTypeMobile {
|
||||
err = userProvider.UpdateUserMobile(authInfo.GetID(), newAuthInfo.AuthBindInfo.AuthID)
|
||||
err = userProvider.UpdateUserMobile(user.GetID(), newAuthInfo.AuthBindInfo.AuthID)
|
||||
} else if newAuthInfo.AuthBindInfo.Type == AuthTypeEmail {
|
||||
err = userProvider.UpdateUserEmail(authInfo.GetID(), newAuthInfo.AuthBindInfo.AuthID)
|
||||
err = userProvider.UpdateUserEmail(user.GetID(), newAuthInfo.AuthBindInfo.AuthID)
|
||||
} else {
|
||||
newAuthInfo.AuthBindInfo.UserID = authInfo.GetID()
|
||||
err = authers[newAuthInfo.AuthBindInfo.Type].AddAuthBind(newAuthInfo.AuthBindInfo, authInfo.GetName())
|
||||
newAuthInfo.AuthBindInfo.UserID = user.GetID()
|
||||
err = authers[newAuthInfo.AuthBindInfo.Type].AddAuthBind(newAuthInfo.AuthBindInfo, user.GetName())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user