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

View File

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

View File

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