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