8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-05 01:16:27 +00:00

Fix disable_emailnotyetconfirmed task

This commit is contained in:
Jean-Romain Garnier 2020-04-17 13:14:32 +00:00 committed by Supelec Rezo Rennes
parent 289f6caa88
commit 8c99f54145

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()