Hide email input on admin when disabled

This commit is contained in:
Harvey Tindall 2020-05-12 20:44:04 +01:00
parent 331dbc3d28
commit 7f250b13fb
3 changed files with 12 additions and 6 deletions

View File

@ -170,8 +170,10 @@ $("form#inviteForm").submit(function() {
'<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true" style="margin-right: 0.5rem;"></span>' +
'Loading...';
var send_object = $("form#inviteForm").serializeObject();
if (document.getElementById('send_to_address_enabled').checked) {
send_object['email'] = document.getElementById('send_to_address').value;
if (document.getElementById('sent_to_address') != null) {
if (document.getElementById('send_to_address_enabled').checked) {
send_object['email'] = document.getElementById('send_to_address').value;
}
}
var send = JSON.stringify(send_object);
$.ajax('/generateInvite', {

View File

@ -120,6 +120,7 @@
<select class="form-control" id="minutes" name="minutes">
</select>
</div>
{% if email_enabled %}
<div class="form-group">
<label for="send_to_address">Send invite to address</label>
<div class="input-group">
@ -131,6 +132,7 @@
<input type="email" class="form-control" placeholder="example@example.com" id="send_to_address" disabled>
</div>
</div>
{% endif %}
<button type="submit" id="generateSubmit" class="btn btn-primary">Generate</button>
</form>
</div>

View File

@ -16,7 +16,9 @@ def page_not_found(e):
def admin():
# return app.send_static_file('admin.html')
return render_template('admin.html',
contactMessage='')
contactMessage='',
email_enabled=config.getboolean(
'invite_emails', 'enabled'))
@app.route('/<path:path>')
@ -27,7 +29,6 @@ def static_proxy(path):
contactMessage=config['ui']['contact_message']), 404
@app.route('/invite/<path:path>')
def inviteProxy(path):
if checkInvite(path):
@ -48,8 +49,9 @@ def inviteProxy(path):
helpMessage=config['ui']['help_message'],
successMessage=config['ui']['success_message'],
jfLink=config['jellyfin']['server'],
validate=config.getboolean('password_validation',
'enabled'),
validate=config.getboolean(
'password_validation',
'enabled'),
requirements=validator.getCriteria(),
email=email)
elif 'admin.html' not in path and 'admin.html' not in path: