- remove user2.ChangeMobile (use auth2.AddAuthBind instead)
This commit is contained in:
@@ -51,6 +51,8 @@ type IUser interface {
|
||||
|
||||
type IUserProvider interface {
|
||||
GetUser(authID, authIDType string) (user IUser)
|
||||
UpdateUserMobile(userID string, mobile string) (err error)
|
||||
UpdateUserEmail(userID string, email string) (err error)
|
||||
}
|
||||
|
||||
type CaptchaInfo struct {
|
||||
@@ -237,8 +239,14 @@ func AddAuthBind(authInfo *AuthInfo, newAuthInfo *AuthInfo) (err error) {
|
||||
return ErrAuthTypeAlreadyExist
|
||||
}
|
||||
RemoveUserInfo(newAuthInfo.Token)
|
||||
newAuthInfo.AuthBindInfo.UserID = authInfo.GetID()
|
||||
err = authers[newAuthInfo.AuthBindInfo.Type].AddAuthBind(newAuthInfo.AuthBindInfo, authInfo.GetName())
|
||||
if newAuthInfo.AuthBindInfo.Type == AuthTypeMobile {
|
||||
err = userProvider.UpdateUserMobile(authInfo.GetID(), newAuthInfo.AuthBindInfo.AuthID)
|
||||
} else if newAuthInfo.AuthBindInfo.Type == AuthTypeEmail {
|
||||
err = userProvider.UpdateUserEmail(authInfo.GetID(), newAuthInfo.AuthBindInfo.AuthID)
|
||||
} else {
|
||||
newAuthInfo.AuthBindInfo.UserID = authInfo.GetID()
|
||||
err = authers[newAuthInfo.AuthBindInfo.Type].AddAuthBind(newAuthInfo.AuthBindInfo, authInfo.GetName())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user