8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-27 07:02:26 +00:00

Fix disable_emailnotyetconfirmed task

This commit is contained in:
Jean-Romain Garnier 2020-04-17 13:14:32 +00:00 committed by Gabriel Detraz
parent 0c1cf9ac94
commit 0a8ed0bb40

View file

@ -34,11 +34,11 @@ class Command(BaseCommand):
days = OptionalUser.get_cached_value("disable_emailnotyetconfirmed")
users_to_disable = (
User.objects.filter(state=User.STATE_EMAIL_NOT_YET_CONFIRMED)
.exclude(email_change_date__is_null=True)
.filter(email_change_date__lte=timezone.now() - timedelta(days=days))
.distinct()
)
print("Disabling " + str(users_to_disable.count()) + " users.")
for user in users_to_disable:
self.state = User.STATE_DISABLED
user.state = User.STATE_DISABLED
user.save()