OpenSlides/server/openslides/users/management/commands/insecurechangepassword.py
FinnStutzenstein 2bcab5d098
Repository restructure
- moved all server related things into the folder `server`, so this
configuration is parallel to the client.
- All main "services" are now folders in the root directory
- Added Dockerfiles to each service (currently server and client)
- Added a docker compose configuration to start everything together.
Currently there are heavy dependencies into https://github.com/OpenSlides/openslides-docker-compose
- Resturctured the .gitignore. If someone needs something excluded,
please add it to the right section.
- Added initial build setup with Docker and docker-compose.
- removed setup.py. We won't deliver OpenSlides via pip anymore.
2020-08-21 08:11:13 +02:00

28 lines
801 B
Python

from django.core.management.base import BaseCommand
from openslides.users.models import User
class Command(BaseCommand):
"""
Command to change a user's password.
"""
help = "Changes user password."
def add_arguments(self, parser):
parser.add_argument(
"username", help="The name of the user to set the password for"
)
parser.add_argument("password", help="The new password of the user")
def handle(self, *args, **options):
user = User.objects.get(username=options["username"])
user.set_password(options["password"])
user.save(skip_autoupdate=True)
self.stdout.write(
self.style.SUCCESS(
f"Password of user {options['username']} successfully changed."
)
)