pull/997/head
Louis Vézina 5 years ago
parent 7490e73a10
commit da7addac4e

@ -83,7 +83,6 @@ def check_credentials(user, pw):
def login_required(f):
@wraps(f)
def wrap(*args, **kwargs):
test = request
if settings.auth.type == 'basic':
auth = request.authorization
if not (auth and check_credentials(request.authorization.username, request.authorization.password)):
@ -151,7 +150,6 @@ def post_get(name, default=''):
@app.route("/logout/")
@login_required
def logout():
test = settings.auth.type
if settings.auth.type == 'basic':
return abort(401)
elif settings.auth.type == 'form':
@ -484,6 +482,7 @@ def test_url(protocol, url):
return dict(status=False, error=result.raise_for_status())
@app.route('/test_notification', methods=['GET'])
@app.route('/test_notification/<protocol>/<path:provider>', methods=['GET'])
@login_required
def test_notification(protocol, provider):
@ -497,6 +496,8 @@ def test_notification(protocol, provider):
body='Test notification'
)
return '', 200
# Mute DeprecationWarning
warnings.simplefilter("ignore", DeprecationWarning)

@ -95,6 +95,7 @@
</div>
</div>
<div class="modal-footer">
<button type="button" id="test_button" class="btn btn-secondary">Test</button>
<button type="submit" id="edit_save_button" class="btn btn-info">Ok</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button>
</div>
@ -212,6 +213,23 @@
});
});
$('#test_button').on('click', function() {
const url_field = $('#notification_provider_url').val();
const url_protocol = url_field.split(':')[0];
const url_string = url_field.split('://')[1];
$.ajax({
url: "{{ url_for('test_notification') }}/" + url_protocol + "/" + encodeURIComponent(url_string),
beforeSend: function () {
$('#loader').addClass('active');
},
complete: function () {
$('#loader').removeClass('active');
},
cache: false
});
});
// monitor changes to the settings_form
$('#settings_form').on('change', function() {
form_changed = true;

Loading…
Cancel
Save