diff --git a/src/objects/accounts/management/commands/createinitialsuperuser.py b/src/objects/accounts/management/commands/createinitialsuperuser.py index 436dadc0..42680e00 100644 --- a/src/objects/accounts/management/commands/createinitialsuperuser.py +++ b/src/objects/accounts/management/commands/createinitialsuperuser.py @@ -1,4 +1,6 @@ import os +import secrets +import string from django.conf import settings from django.contrib.auth.management.commands.createsuperuser import ( @@ -50,7 +52,8 @@ def handle(self, **options): user = qs.get() if not password and options["generate_password"]: - password = self.UserModel.objects.make_random_password(length=20) + alphabet = string.ascii_letters + string.digits + password = "".join(secrets.choice(alphabet) for _ in range(20)) if password: self.stdout.write("Setting user password...")