fix delete user failed on sqlite (#1321)
This commit is contained in:
parent
bd8fe49076
commit
888dee3b5f
2 changed files with 6 additions and 6 deletions
|
@ -9,8 +9,8 @@ import "github.com/markbates/goth"
|
||||||
// ExternalLoginUser makes the connecting between some existing user and additional external login sources
|
// ExternalLoginUser makes the connecting between some existing user and additional external login sources
|
||||||
type ExternalLoginUser struct {
|
type ExternalLoginUser struct {
|
||||||
ExternalID string `xorm:"NOT NULL"`
|
ExternalID string `xorm:"NOT NULL"`
|
||||||
UserID int64 `xorm:"NOT NULL"`
|
UserID int64 `xorm:"NOT NULL"`
|
||||||
LoginSourceID int64 `xorm:"NOT NULL"`
|
LoginSourceID int64 `xorm:"NOT NULL"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetExternalLogin checks if a externalID in loginSourceID scope already exists
|
// GetExternalLogin checks if a externalID in loginSourceID scope already exists
|
||||||
|
@ -67,8 +67,8 @@ func RemoveAccountLink(user *User, loginSourceID int64) (int64, error) {
|
||||||
return deleted, err
|
return deleted, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// RemoveAllAccountLinks will remove all external login sources for the given user
|
// removeAllAccountLinks will remove all external login sources for the given user
|
||||||
func RemoveAllAccountLinks(user *User) error {
|
func removeAllAccountLinks(e Engine, user *User) error {
|
||||||
_, err := x.Delete(&ExternalLoginUser{UserID: user.ID})
|
_, err := e.Delete(&ExternalLoginUser{UserID: user.ID})
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
@ -990,7 +990,7 @@ func deleteUser(e *xorm.Session, u *User) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ***** START: ExternalLoginUser *****
|
// ***** START: ExternalLoginUser *****
|
||||||
if err = RemoveAllAccountLinks(u); err != nil {
|
if err = removeAllAccountLinks(e, u); err != nil {
|
||||||
return fmt.Errorf("ExternalLoginUser: %v", err)
|
return fmt.Errorf("ExternalLoginUser: %v", err)
|
||||||
}
|
}
|
||||||
// ***** END: ExternalLoginUser *****
|
// ***** END: ExternalLoginUser *****
|
||||||
|
|
Loading…
Reference in a new issue