Don't show the registration form if registration is disabled.

This commit is contained in:
voussoir 2021-10-24 22:17:50 -07:00
parent 842dad3243
commit 779eff1761
No known key found for this signature in database
GPG key ID: 5F7554F8C26DACCB
2 changed files with 5 additions and 0 deletions

View file

@ -62,6 +62,7 @@ def get_login():
'login.html', 'login.html',
min_username_length=common.P.config['user']['min_username_length'], min_username_length=common.P.config['user']['min_username_length'],
min_password_length=common.P.config['user']['min_password_length'], min_password_length=common.P.config['user']['min_password_length'],
registration_enabled=common.P.config['enable_feature']['user']['new'],
) )
return response return response

View file

@ -80,11 +80,15 @@ form h2
</form> </form>
<form id="register_form" class="panel" action="/register" method="post"> <form id="register_form" class="panel" action="/register" method="post">
<h2>Register</h2> <h2>Register</h2>
{% if registration_enabled %}
<input type="text" id="register_input_username" name="username" placeholder="username (at least {{min_username_length}})"> <input type="text" id="register_input_username" name="username" placeholder="username (at least {{min_username_length}})">
<input type="text" id="register_input_display_name" name="display_name" placeholder="display name (optional)"> <input type="text" id="register_input_display_name" name="display_name" placeholder="display name (optional)">
<input type="password" id="register_input_password_1" name="password_1" placeholder="password (at least {{min_password_length}})"> <input type="password" id="register_input_password_1" name="password_1" placeholder="password (at least {{min_password_length}})">
<input type="password" id="register_input_password_2" name="password_2" placeholder="password again"> <input type="password" id="register_input_password_2" name="password_2" placeholder="password again">
<button type="submit" id="register_input_button" class="green_button" onclick="return register_form(event);">Register</button> <button type="submit" id="register_input_button" class="green_button" onclick="return register_form(event);">Register</button>
{% else %}
<span>Registrations are disabled.</span>
{% endif %}
</form> </form>
<div id="message_area" class="panel"> <div id="message_area" class="panel">
</div> </div>