Add option to use email address as username

Added option email/no_username to disable username input on form, and
instead use the provided email address as the username. Also added
missing 'packaging' dep from pevious update.
This commit is contained in:
2020-06-29 00:35:51 +01:00
parent 09bbe8fddf
commit 68a459023c
7 changed files with 49 additions and 6 deletions

View File

@@ -68,12 +68,14 @@
<form action="#" method="POST">
<div class="form-group">
<label for="inputEmail">Email</label>
<input type="email" class="form-control" id="inputEmail" name="email" placeholder="Email" value="{{ email }}" required>
<input type="email" class="form-control" id="{% if username %}inputEmail{% else %}inputUsername{% endif %}" name="{% if username %}email{% else %}username{% endif %}" placeholder="Email" value="{{ email }}" required>
</div>
{% if username %}
<div class="form-group">
<label for="inputUsername">Username</label>
<input type="username" class="form-control" id="inputUsername" name="username" placeholder="Username" required>
</div>
{% endif %}
<div class="form-group">
<label for="inputPassword">Password</label>
<input type="password" class="form-control" id="inputPassword" name="password" placeholder="Password" required>
@@ -133,6 +135,9 @@
toggleSpinner();
var send = $("form").serializeObject();
send['code'] = code;
{% if not username %}
send['email'] = send['username'];
{% endif %}
send = JSON.stringify(send);
$.ajax('/newUser', {
data : send,