mirror of
https://github.com/evennia/evennia.git
synced 2026-03-30 20:47:17 +02:00
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"
|
||||
)
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue