- 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
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ func (a *Auther) VerifySecret(state, code string) (authBindEx *auth2.AuthBindEx,
|
||||
if err = err2; err == nil {
|
||||
wxUserinfo, err2 := api.WeixinPageAPI.SNSGetUserInfo(token.AccessToken, token.OpenID)
|
||||
if err = err2; err == nil {
|
||||
if authBindEx, err = a.UnionFindAuthBind(a.authType, []string{AuthTypeWeixin, AuthTypeMini, AuthTypeMini}, wxUserinfo.OpenID, wxUserinfo.UnionID, wxUserinfo); err == nil {
|
||||
if authBindEx, err = a.UnionFindAuthBind(a.authType, []string{AuthTypeWeixin, AuthTypeMP, AuthTypeMini}, wxUserinfo.OpenID, wxUserinfo.UnionID, wxUserinfo); err == nil {
|
||||
authBindEx.UserHint = &auth2.UserBasic{
|
||||
Name: wxUserinfo.NickName,
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ func (a *MiniAuther) VerifySecret(dummy, jsCode string) (authBindEx *auth2.AuthB
|
||||
if err == nil {
|
||||
sessionKey := sessionInfo.SessionKey
|
||||
sessionInfo.SessionKey = ""
|
||||
if authBindEx, err = a.UnionFindAuthBind(AuthTypeMini, []string{AuthTypeWeixin, AuthTypeMini, AuthTypeMini}, sessionInfo.OpenID, sessionInfo.UnionID, sessionInfo); err == nil {
|
||||
if authBindEx, err = a.UnionFindAuthBind(AuthTypeMini, []string{AuthTypeWeixin, AuthTypeMP, AuthTypeMini}, sessionInfo.OpenID, sessionInfo.UnionID, sessionInfo); err == nil {
|
||||
authBindEx.UserData = sessionKey
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user