Add reset script
This commit is contained in:
parent
e8ca7ccccf
commit
bdeef5323f
|
|
@ -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()
|
||||||
Loading…
Reference in New Issue