diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2017-03-20 22:13:52 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-03-20 22:13:52 +0800 |
commit | 888dee3b5f931062ea97e57130b26d1943e5173e (patch) | |
tree | b2c17ef8415db45998bb8d706611d3fff5e7faf0 /models | |
parent | bd8fe49076e0f880fbb923822f2247b57f9799e9 (diff) | |
download | gitea-888dee3b5f931062ea97e57130b26d1943e5173e.tar.gz gitea-888dee3b5f931062ea97e57130b26d1943e5173e.zip |
fix delete user failed on sqlite (#1321)
Diffstat (limited to 'models')
-rw-r--r-- | models/external_login_user.go | 10 | ||||
-rw-r--r-- | models/user.go | 2 |
2 files changed, 6 insertions, 6 deletions
diff --git a/models/external_login_user.go b/models/external_login_user.go index ade1b8a13b..b2680943c4 100644 --- a/models/external_login_user.go +++ b/models/external_login_user.go @@ -9,8 +9,8 @@ import "github.com/markbates/goth" // ExternalLoginUser makes the connecting between some existing user and additional external login sources type ExternalLoginUser struct { ExternalID string `xorm:"NOT NULL"` - UserID int64 `xorm:"NOT NULL"` - LoginSourceID int64 `xorm:"NOT NULL"` + UserID int64 `xorm:"NOT NULL"` + LoginSourceID int64 `xorm:"NOT NULL"` } // 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 } -// RemoveAllAccountLinks will remove all external login sources for the given user -func RemoveAllAccountLinks(user *User) error { - _, err := x.Delete(&ExternalLoginUser{UserID: user.ID}) +// removeAllAccountLinks will remove all external login sources for the given user +func removeAllAccountLinks(e Engine, user *User) error { + _, err := e.Delete(&ExternalLoginUser{UserID: user.ID}) return err } diff --git a/models/user.go b/models/user.go index ad303d7535..72c21f4369 100644 --- a/models/user.go +++ b/models/user.go @@ -990,7 +990,7 @@ func deleteUser(e *xorm.Session, u *User) error { } // ***** START: ExternalLoginUser ***** - if err = RemoveAllAccountLinks(u); err != nil { + if err = removeAllAccountLinks(e, u); err != nil { return fmt.Errorf("ExternalLoginUser: %v", err) } // ***** END: ExternalLoginUser ***** |