diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-06-29 19:50:02 +0300 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-06-29 19:50:02 +0300 |
commit | 84c1547c853081bf101528ecc60529e023ebc2ff (patch) | |
tree | 7a4c7bb3c59912f810ac10f9ddd77e5c3f42fe0b /js/admin.js | |
parent | 03646e61590d206e34cb19251af9377a61563282 (diff) |
Add application specific passwords
Fixes https://github.com/nextcloud/user_saml/issues/1
Diffstat (limited to 'js/admin.js')
-rw-r--r-- | js/admin.js | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/js/admin.js b/js/admin.js new file mode 100644 index 00000000..9ee0ee4b --- /dev/null +++ b/js/admin.js @@ -0,0 +1,60 @@ +function setSAMLConfigValue(category, setting, value) { + OC.msg.startSaving('#user-saml-save-indicator'); + OC.AppConfig.setValue('user_saml', category+'-'+setting, value); + OC.msg.finishedSaving('#user-saml-save-indicator', {status: 'success', data: {message: t('user_saml', 'Saved')}}); +} + +$(function() { + // Enable tabs + $('#user-saml-settings').tabs(); + $('input:checkbox[value="1"]').attr('checked', true); + + $('#user-saml-sp input[type="text"], #user-saml-sp textarea').change(function(e) { + var el = $(this); + $.when(el.focusout()).then(function() { + var key = $(this).attr('name'); + setSAMLConfigValue('sp', key, $(this).val()); + }); + if (e.keyCode === 13) { + var key = $(this).attr('name'); + setSAMLConfigValue('sp', key, $(this).val()); + } + }); + + $('#user-saml-idp input[type="text"], #user-saml-idp textarea').change(function(e) { + var el = $(this); + $.when(el.focusout()).then(function() { + var key = $(this).attr('name'); + setSAMLConfigValue('idp', key, $(this).val()); + }); + if (e.keyCode === 13) { + var key = $(this).attr('name'); + setSAMLConfigValue('idp', key, $(this).val()); + } + }); + + $('#user-saml-general input[type="text"], #user-saml-general textarea').change(function(e) { + var el = $(this); + $.when(el.focusout()).then(function() { + var key = $(this).attr('name'); + setSAMLConfigValue('general', key, $(this).val()); + }); + if (e.keyCode === 13) { + var key = $(this).attr('name'); + setSAMLConfigValue('general', key, $(this).val()); + } + }); + + $('#user-saml-security input[type="checkbox"]').change(function(e) { + var el = $(this); + $.when(el.focusout()).then(function() { + var key = $(this).attr('name'); + if($(this).val() === "0") { + $(this).val("1"); + } else { + $(this).val("0"); + } + setSAMLConfigValue('security', key, $(this).val()); + }); + }); +}); |