diff options
author | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2022-06-01 15:00:53 +0300 |
---|---|---|
committer | Arthur Schiwon <blizzz@arthur-schiwon.de> | 2022-06-01 15:00:53 +0300 |
commit | 14489518d76b5e0ced3213e09f2143140b234674 (patch) | |
tree | 2c8962bdcc24875106e0552a20b8ecfc5541fb86 | |
parent | c91a6782930e7310cd32463622d584e1f7b66c7a (diff) |
fixes testing meta data before applying settings
- when a setting is changed() fetching the meta data is run first,
before storing the value
- it may appear that a breaking change is good, or
- vice versa that a, actual fixing change does not have effect
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
-rw-r--r-- | js/admin.js | 37 |
1 files changed, 18 insertions, 19 deletions
diff --git a/js/admin.js b/js/admin.js index 57f1eb90..e87c3b04 100644 --- a/js/admin.js +++ b/js/admin.js @@ -127,6 +127,23 @@ } }, + testMetaData: function() { + // Checks on each request whether the settings make sense or not + $.ajax({ + url: OC.generateUrl('/apps/user_saml/saml/metadata'), + data: { idp: OCA.User_SAML.Admin.getConfigIdentifier() }, + type: 'GET' + }).fail(function (e) { + if (e.status === 500) { + $('#user-saml-settings-complete').addClass('hidden'); + $('#user-saml-settings-incomplete').removeClass('hidden'); + } + }).success(function () { + $('#user-saml-settings-complete').removeClass('hidden'); + $('#user-saml-settings-incomplete').addClass('hidden'); + }); + }, + setSamlConfigValue: function(category, setting, value, global) { if (OC.PasswordConfirmation.requiresPasswordConfirmation()) { OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this.setSamlConfigValue, this, category, setting, value)); @@ -137,6 +154,7 @@ var callbacks = { success: function () { OC.msg.finishedSaving('#user-saml-save-indicator', {status: 'success', data: {message: t('user_saml', 'Saved')}}); + OCA.User_SAML.Admin.testMetaData(); }, error: function() { OC.msg.finishedSaving('#user-saml-save-indicator', {status: 'error', data: {message: t('user_saml', 'Could not save')}}); @@ -394,25 +412,6 @@ $(function() { } }); - $('#user-saml').change(function() { - if(type === 'saml') { - // Checks on each request whether the settings make sense or not - $.ajax({ - url: OC.generateUrl('/apps/user_saml/saml/metadata'), - data: { idp: OCA.User_SAML.Admin.getConfigIdentifier() }, - 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(), |