summaryrefslogtreecommitdiffstats
path: root/models/user.go
diff options
context:
space:
mode:
author6543 <6543@obermui.de>2022-05-11 13:16:35 +0200
committerGitHub <noreply@github.com>2022-05-11 13:16:35 +0200
commitf41c2bec4ccadb0c147ca2588f4a00d60ae6c594 (patch)
tree4b8543a206a7fe23c518bc8f89f7f22b9f23dc4c /models/user.go
parentcbd45471b1100bffcd2f18719b56a5da5468756b (diff)
downloadgitea-f41c2bec4ccadb0c147ca2588f4a00d60ae6c594.tar.gz
gitea-f41c2bec4ccadb0c147ca2588f4a00d60ae6c594.zip
Delete user related oauth stuff on user deletion too (#19677)
* delete user related oauth stuff on user deletion too * extend doctor check-db-consistency
Diffstat (limited to 'models/user.go')
-rw-r--r--models/user.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/models/user.go b/models/user.go
index e805c746cb..6816527e47 100644
--- a/models/user.go
+++ b/models/user.go
@@ -13,6 +13,7 @@ import (
_ "image/jpeg" // Needed for jpeg support
asymkey_model "code.gitea.io/gitea/models/asymkey"
+ auth_model "code.gitea.io/gitea/models/auth"
"code.gitea.io/gitea/models/db"
"code.gitea.io/gitea/models/issues"
"code.gitea.io/gitea/models/organization"
@@ -89,6 +90,10 @@ func DeleteUser(ctx context.Context, u *user_model.User) (err error) {
return fmt.Errorf("deleteBeans: %v", err)
}
+ if err := auth_model.DeleteOAuth2RelictsByUserID(ctx, u.ID); err != nil {
+ return err
+ }
+
if setting.Service.UserDeleteWithCommentsMaxTime != 0 &&
u.CreatedUnix.AsTime().Add(setting.Service.UserDeleteWithCommentsMaxTime).After(time.Now()) {