Add reset script

This commit is contained in:
Ramon Wenger 2021-03-15 23:19:45 +01:00
parent e8ca7ccccf
commit bdeef5323f
1 changed files with 17 additions and 0 deletions

View File

@ -0,0 +1,17 @@
from django.contrib.auth import get_user_model
from django.core.management import BaseCommand
class Command(BaseCommand):
def handle(self, *args, **options):
self.stdout.write("Caution:")
self.stdout.write("Do you really want to reset **ALL** passwords")
self.stdout.write("If so, type \"YES\"")
result = input()
if result == 'YES':
users = get_user_model().objects.all()
for user in users:
user.set_password('test')
user.save()