[PATCH] cron: fix deletion of unactivated accounts

Daniel Axtens dja at axtens.net
Tue Jul 11 16:30:48 AEST 2017


There is a test in expire_notifications() that tries to check if
the user's last login matches the date joined. (I think the login
date is not set until a post-activation login.) This does not work:
on patchwork.ozlabs.org there are 10k users that have never been
deleted.

Drop the date test: it should be sufficient that a user is not
active and their confirmation is not pending.

Reported-by: Stephen Rothwell <sfr at canb.auug.org.au>
Signed-off-by: Daniel Axtens <dja at axtens.net>
---
 patchwork/notifications.py | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/patchwork/notifications.py b/patchwork/notifications.py
index 16152ef9d195..73932da866d4 100644
--- a/patchwork/notifications.py
+++ b/patchwork/notifications.py
@@ -109,8 +109,7 @@ def expire_notifications():
 
     # remove inactive users with no pending confirmation
     pending_confs = EmailConfirmation.objects.values('user')
-    users = User.objects.filter(is_active=False,
-                                last_login=F('date_joined')).exclude(
+    users = User.objects.filter(is_active=False).exclude(
                                     id__in=pending_confs)
 
     # delete users
-- 
2.11.0



More information about the Patchwork mailing list