From 1160b2c8747f02b82453e3ccca460ea57917c377 Mon Sep 17 00:00:00 2001 From: Lukas Reschke Date: Tue, 5 Jul 2016 10:59:41 +0200 Subject: [PATCH] Add hint whether settings may work Fixes https://github.com/nextcloud/user_saml/issues/14 --- js/admin.js | 16 ++++++++++++++++ templates/admin.php | 4 ++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/js/admin.js b/js/admin.js index 0e561fa..cdb39ae 100644 --- a/js/admin.js +++ b/js/admin.js @@ -70,6 +70,22 @@ $(function() { }); }); + $('#user-saml').change(function() { + // Checks on each request whether the settings make sense or not + $.ajax({ + url: OC.generateUrl('/apps/user_saml/saml/metadata'), + type: 'GET' + }).fail(function (e) { + if(e.status === 500) { + $('#user-saml-settings-complete').addClass('hidden'); + $('#user-saml-settings-incomplete').removeClass('hidden'); + } + }).success(function (e) { + $('#user-saml-settings-complete').removeClass('hidden'); + $('#user-saml-settings-incomplete').addClass('hidden'); + }) + }); + $('#user-saml-settings .toggle').on('click', function() { var el = $(this), nextSibling = el.parent().next(), diff --git a/templates/admin.php b/templates/admin.php index d5282ba..a0ce55e 100644 --- a/templates/admin.php +++ b/templates/admin.php @@ -80,7 +80,7 @@ style('user_saml', 'admin'); t('Download metadata XML')) ?> - - t('Test settings')) ?> + +