mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-16 21:12:13 +00:00
Don't automatically deactivate anyone that's never logged in
That's bloody stupid
This commit is contained in:
@@ -12,8 +12,8 @@ class Command(BaseCommand):
|
|||||||
|
|
||||||
def handle(self, *args, **options):
|
def handle(self, *args, **options):
|
||||||
for person in Profile.objects.all():
|
for person in Profile.objects.all():
|
||||||
# Inactivate users that have not logged in for a year (or have never logged in)
|
# Inactivate users that have not logged in for a year
|
||||||
if person.last_login is None or (timezone.now() - person.last_login).days > 365:
|
if person.last_login is not None and (timezone.now() - person.last_login).days > 365:
|
||||||
person.is_active = False
|
person.is_active = False
|
||||||
person.is_approved = False
|
person.is_approved = False
|
||||||
person.save()
|
person.save()
|
||||||
|
|||||||
Reference in New Issue
Block a user