- auth2.AddAuthBind的第一个参数从*AuthInfo改为IUser

This commit is contained in:
gazebo
2019-08-06 11:18:38 +08:00
parent 88ebbbf9e7
commit 407844aa81
3 changed files with 8 additions and 8 deletions

View File

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