From 54ebbde3a7e4a6b5b237ab8b0015ff50991e57b3 Mon Sep 17 00:00:00 2001 From: Stephen Meier Date: Fri, 22 Jan 2021 23:22:35 -0500 Subject: [PATCH] Code clean up and check to make sure length of password is greater than 0 --- evennia/server/evennia_launcher.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/evennia/server/evennia_launcher.py b/evennia/server/evennia_launcher.py index e800a36ce6..f59091d412 100644 --- a/evennia/server/evennia_launcher.py +++ b/evennia/server/evennia_launcher.py @@ -1424,11 +1424,14 @@ def create_superuser(): "account of the server. Email is optional and can be empty.\n" ) from os import environ - if ("EVENNIA_SUPERUSER_USERNAME" in environ) and ("EVENNIA_SUPERUSER_PASSWORD" in environ): + + username = environ.get("EVENNIA_SUPERUSER_USERNAME") + email = environ.get("EVENNIA_SUPERUSER_EMAIL") + password = environ.get("EVENNIA_SUPERUSER_PASSWORD") + + if (username is not None) and (password is not None) and len(password) > 0: from evennia.accounts.models import AccountDB - superuser = AccountDB.objects.create_superuser(os.environ.get("EVENNIA_SUPERUSER_USERNAME"), - os.environ.get("EVENNIA_SUPERUSER_EMAIL"), - os.environ.get("EVENNIA_SUPERUSER_PASSWORD")) + superuser = AccountDB.objects.create_superuser(username, email, password) superuser.save() else: django.core.management.call_command("createsuperuser", interactive=True)