registration setting
This commit is contained in:
parent
0bde1a034b
commit
04e036978c
4 changed files with 39 additions and 23 deletions
|
|
@ -172,6 +172,15 @@ class CmdUnconnectedCreate(COMMAND_DEFAULT_CLASS):
|
||||||
locks = "cmd:all()"
|
locks = "cmd:all()"
|
||||||
arg_regex = r"\s.*?|$"
|
arg_regex = r"\s.*?|$"
|
||||||
|
|
||||||
|
def at_pre_cmd(self):
|
||||||
|
"""Verify that account creation is enabled."""
|
||||||
|
if not settings.REGISTER_ENABLED:
|
||||||
|
# truthy return cancels the command
|
||||||
|
self.msg("Registration is currently disabled.")
|
||||||
|
return True
|
||||||
|
|
||||||
|
return super().at_pre_cmd()
|
||||||
|
|
||||||
def func(self):
|
def func(self):
|
||||||
"""Do checks and create account"""
|
"""Do checks and create account"""
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,6 +34,8 @@ SERVER_HOSTNAME = "localhost"
|
||||||
# Lockdown mode will cut off the game from any external connections
|
# Lockdown mode will cut off the game from any external connections
|
||||||
# and only allow connections from localhost. Requires a cold reboot.
|
# and only allow connections from localhost. Requires a cold reboot.
|
||||||
LOCKDOWN_MODE = False
|
LOCKDOWN_MODE = False
|
||||||
|
# Enables new account registration
|
||||||
|
REGISTER_ENABLED = True
|
||||||
# Activate telnet service
|
# Activate telnet service
|
||||||
TELNET_ENABLED = True
|
TELNET_ENABLED = True
|
||||||
# A list of ports the Evennia telnet server listens on Can be one or many.
|
# A list of ports the Evennia telnet server listens on Can be one or many.
|
||||||
|
|
|
||||||
|
|
@ -78,10 +78,12 @@ folder and edit it to add/remove links to the menu.
|
||||||
<li>
|
<li>
|
||||||
<a class="nav-link" href="{% url 'login' %}?next={{ request.path }}">Log In</a>
|
<a class="nav-link" href="{% url 'login' %}?next={{ request.path }}">Log In</a>
|
||||||
</li>
|
</li>
|
||||||
|
{% if register_enabled %}
|
||||||
<li>
|
<li>
|
||||||
<a class="nav-link" href="{% url 'register' %}">Register</a>
|
<a class="nav-link" href="{% url 'register' %}">Register</a>
|
||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% endif %}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ Register
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if not user.is_authenticated %}
|
{% if not user.is_authenticated %}
|
||||||
|
{% if register_enabled %}
|
||||||
<form method="post" action="?">
|
<form method="post" action="?">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
|
|
||||||
|
|
@ -46,7 +47,9 @@ Register
|
||||||
<input type="hidden" name="next" value="{{ next }}" />
|
<input type="hidden" name="next" value="{{ next }}" />
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
{% else %}
|
||||||
|
<p>Registration is currently disabled.</p>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue