Code clean up and check to make sure length of password is greater than 0
This commit is contained in:
parent
ce279de7c3
commit
54ebbde3a7
1 changed files with 7 additions and 4 deletions
|
|
@ -1424,11 +1424,14 @@ def create_superuser():
|
||||||
"account of the server. Email is optional and can be empty.\n"
|
"account of the server. Email is optional and can be empty.\n"
|
||||||
)
|
)
|
||||||
from os import environ
|
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
|
from evennia.accounts.models import AccountDB
|
||||||
superuser = AccountDB.objects.create_superuser(os.environ.get("EVENNIA_SUPERUSER_USERNAME"),
|
superuser = AccountDB.objects.create_superuser(username, email, password)
|
||||||
os.environ.get("EVENNIA_SUPERUSER_EMAIL"),
|
|
||||||
os.environ.get("EVENNIA_SUPERUSER_PASSWORD"))
|
|
||||||
superuser.save()
|
superuser.save()
|
||||||
else:
|
else:
|
||||||
django.core.management.call_command("createsuperuser", interactive=True)
|
django.core.management.call_command("createsuperuser", interactive=True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue