aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-05-13 14:49:22 +0200
committerGitHub <noreply@github.com>2022-05-13 14:49:22 +0200
commit61f939359d0b5b478962d7afdc053af23836461f (patch)
treee8794a2426f79ed435957b2324720779cf78107a
parentcafa2dcb871961c3314b5a6bfafa666153712bb4 (diff)
downloadgitea-61f939359d0b5b478962d7afdc053af23836461f.tar.gz
gitea-61f939359d0b5b478962d7afdc053af23836461f.zip
Use a better OlderThan for DeleteInactiveUsers (#19693)
* Use a better OlderThan for DeleteInactiveUsers - Currently the OlderThan is zero, for instances that enable or run this task this could actually delete just new users that still need to confirm their email. This patch fixes that by setting the default to the `ActiveCodeLives` setting, which corresponds to the amount of time that a user can active their account, thus avoiding the issue of deleting unactivated email users. * Use correct duration
-rw-r--r--services/cron/tasks_extended.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/cron/tasks_extended.go b/services/cron/tasks_extended.go
index 2d1bf53234..ec7ced99e9 100644
--- a/services/cron/tasks_extended.go
+++ b/services/cron/tasks_extended.go
@@ -26,7 +26,7 @@ func registerDeleteInactiveUsers() {
RunAtStart: false,
Schedule: "@annually",
},
- OlderThan: 0 * time.Second,
+ OlderThan: time.Minute * time.Duration(setting.Service.ActiveCodeLives),
}, func(ctx context.Context, _ *user_model.User, config Config) error {
olderThanConfig := config.(*OlderThanConfig)
return user_service.DeleteInactiveUsers(ctx, olderThanConfig.OlderThan)