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>
This commit is contained in:
Arthur Schiwon 2022-06-01 14:00:53 +02:00
parent c91a678293
commit 14489518d7
No known key found for this signature in database
GPG Key ID: 7424F1874854DF23
1 changed files with 18 additions and 19 deletions

View File

@ -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(),