mirror of
https://github.com/netzbegruenung/user_saml.git
synced 2024-04-27 06:44:53 +02:00
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:
parent
c91a678293
commit
14489518d7
37
js/admin.js
37
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) {
|
setSamlConfigValue: function(category, setting, value, global) {
|
||||||
if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
|
if (OC.PasswordConfirmation.requiresPasswordConfirmation()) {
|
||||||
OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this.setSamlConfigValue, this, category, setting, value));
|
OC.PasswordConfirmation.requirePasswordConfirmation(_.bind(this.setSamlConfigValue, this, category, setting, value));
|
||||||
|
@ -137,6 +154,7 @@
|
||||||
var callbacks = {
|
var callbacks = {
|
||||||
success: function () {
|
success: function () {
|
||||||
OC.msg.finishedSaving('#user-saml-save-indicator', {status: 'success', data: {message: t('user_saml', 'Saved')}});
|
OC.msg.finishedSaving('#user-saml-save-indicator', {status: 'success', data: {message: t('user_saml', 'Saved')}});
|
||||||
|
OCA.User_SAML.Admin.testMetaData();
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
OC.msg.finishedSaving('#user-saml-save-indicator', {status: 'error', data: {message: t('user_saml', 'Could not save')}});
|
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() {
|
$('#user-saml-settings .toggle').on('click', function() {
|
||||||
var el = $(this),
|
var el = $(this),
|
||||||
nextSibling = el.parent().next(),
|
nextSibling = el.parent().next(),
|
||||||
|
|
Loading…
Reference in a new issue