mirror of
https://github.com/evennia/evennia.git
synced 2026-03-24 16:56:32 +01:00
registration setting
This commit is contained in:
parent
60a4626d79
commit
a3e75df228
4 changed files with 39 additions and 23 deletions
|
|
@ -172,6 +172,15 @@ class CmdUnconnectedCreate(COMMAND_DEFAULT_CLASS):
|
|||
locks = "cmd:all()"
|
||||
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):
|
||||
"""Do checks and create account"""
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,8 @@ SERVER_HOSTNAME = "localhost"
|
|||
# Lockdown mode will cut off the game from any external connections
|
||||
# and only allow connections from localhost. Requires a cold reboot.
|
||||
LOCKDOWN_MODE = False
|
||||
# Enables new account registration
|
||||
REGISTER_ENABLED = True
|
||||
# Activate telnet service
|
||||
TELNET_ENABLED = True
|
||||
# A list of ports the Evennia telnet server listens on Can be one or many.
|
||||
|
|
|
|||
|
|
@ -78,9 +78,11 @@ folder and edit it to add/remove links to the menu.
|
|||
<li>
|
||||
<a class="nav-link" href="{% url 'login' %}?next={{ request.path }}">Log In</a>
|
||||
</li>
|
||||
<li>
|
||||
<a class="nav-link" href="{% url 'register' %}">Register</a>
|
||||
</li>
|
||||
{% if register_enabled %}
|
||||
<li>
|
||||
<a class="nav-link" href="{% url 'register' %}">Register</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -27,26 +27,29 @@ Register
|
|||
{% endif %}
|
||||
|
||||
{% if not user.is_authenticated %}
|
||||
<form method="post" action="?">
|
||||
{% csrf_token %}
|
||||
|
||||
{% for field in form %}
|
||||
<div class="form-field my-3">
|
||||
{{ field.label_tag }}
|
||||
{{ field | addclass:"form-control" }}
|
||||
{% if field.help_text %}
|
||||
<small class="form-text text-muted">{{ field.help_text|safe }}</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<hr />
|
||||
<div class="form-group">
|
||||
<input class="form-control btn btn-outline-secondary" type="submit" value="Register" />
|
||||
<input type="hidden" name="next" value="{{ next }}" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
{% if register_enabled %}
|
||||
<form method="post" action="?">
|
||||
{% csrf_token %}
|
||||
|
||||
{% for field in form %}
|
||||
<div class="form-field my-3">
|
||||
{{ field.label_tag }}
|
||||
{{ field | addclass:"form-control" }}
|
||||
{% if field.help_text %}
|
||||
<small class="form-text text-muted">{{ field.help_text|safe }}</small>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
<hr />
|
||||
<div class="form-group">
|
||||
<input class="form-control btn btn-outline-secondary" type="submit" value="Register" />
|
||||
<input type="hidden" name="next" value="{{ next }}" />
|
||||
</div>
|
||||
</form>
|
||||
{% else %}
|
||||
<p>Registration is currently disabled.</p>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue