2bcab5d098
- 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.
35 lines
1.1 KiB
Python
35 lines
1.1 KiB
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 the admin password, if he exists (username='admin') and the password is the default one ('admin')."
|
|
|
|
def add_arguments(self, parser):
|
|
parser.add_argument("password", help="The new password of the admin")
|
|
|
|
def handle(self, *args, **options):
|
|
try:
|
|
user = User.objects.get(username="admin")
|
|
except User.DoesNotExist:
|
|
self.stdout.write(
|
|
self.style.ERROR("There is no user with the username 'admin'.")
|
|
)
|
|
return
|
|
|
|
if user.check_password("admin"):
|
|
user.set_password(options["password"])
|
|
user.save(skip_autoupdate=True)
|
|
self.stdout.write(
|
|
self.style.SUCCESS("Password of user admin successfully changed.")
|
|
)
|
|
else:
|
|
self.stdout.write(
|
|
self.style.NOTICE("The admin has not the default password. Done.")
|
|
)
|