summaryrefslogtreecommitdiffstats
path: root/apps/user_ldap/js
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@owncloud.com>2014-10-10 13:30:03 +0200
committerArthur Schiwon <blizzz@owncloud.com>2014-10-10 13:30:03 +0200
commitea7975ac8ba94b3dfcd3f61ff74847de97a881b4 (patch)
tree36bc55bdefb38d2b1da5b2a2b15cd374ddd2eaef /apps/user_ldap/js
parentf31d4caf57c46d648180184868d92f4780ba4b35 (diff)
downloadnextcloud-server-ea7975ac8ba94b3dfcd3f61ff74847de97a881b4.tar.gz
nextcloud-server-ea7975ac8ba94b3dfcd3f61ff74847de97a881b4.zip
always abort running ajax request when the method is fired up again
Diffstat (limited to 'apps/user_ldap/js')
-rw-r--r--apps/user_ldap/js/settings.js40
1 files changed, 28 insertions, 12 deletions
diff --git a/apps/user_ldap/js/settings.js b/apps/user_ldap/js/settings.js
index 5c696000f5c..75a4830b28e 100644
--- a/apps/user_ldap/js/settings.js
+++ b/apps/user_ldap/js/settings.js
@@ -148,9 +148,15 @@ var LdapWizard = {
userFilter: false,
loginFilter: false,
groupFilter: false,
+ ajaxRequests: {},
- ajax: function(param, fnOnSuccess, fnOnError) {
- $.post(
+ ajax: function(param, fnOnSuccess, fnOnError, reqID) {
+ if(reqID !== undefined) {
+ if(LdapWizard.ajaxRequests.hasOwnProperty(reqID)) {
+ LdapWizard.ajaxRequests[reqID].abort();
+ }
+ }
+ var request = $.post(
OC.filePath('user_ldap','ajax','wizard.php'),
param,
function(result) {
@@ -161,6 +167,9 @@ var LdapWizard = {
}
}
);
+ if(reqID !== undefined) {
+ LdapWizard.ajaxRequests[reqID] = request;
+ }
},
applyChanges: function (result) {
@@ -244,7 +253,8 @@ var LdapWizard = {
LdapWizard.showInfoBox(t('user_ldap', 'Please specify a Base DN'));
LdapWizard.showInfoBox(t('user_ldap', 'Could not determine Base DN'));
$('#ldap_base').prop('disabled', false);
- }
+ },
+ 'guessBaseDN'
);
}
},
@@ -274,7 +284,8 @@ var LdapWizard = {
LdapWizard.hideSpinner('#ldap_port');
$('#ldap_port').prop('disabled', false);
LdapWizard.showInfoBox(t('user_ldap', 'Please specify the port'));
- }
+ },
+ 'guessPortAndTLS'
);
}
},
@@ -323,7 +334,7 @@ var LdapWizard = {
encodeURIComponent($('#ldap_serverconfig_chooser').val());
LdapWizard.showSpinner(spinnerID);
- LdapWizard.ajax(param,
+ var request = LdapWizard.ajax(param,
function(result) {
LdapWizard.applyChanges(result);
LdapWizard.hideSpinner(spinnerID);
@@ -331,7 +342,8 @@ var LdapWizard = {
function (result) {
OC.Notification.show('Counting the entries failed with, ' + result.message);
LdapWizard.hideSpinner(spinnerID);
- }
+ },
+ method
);
},
@@ -348,7 +360,7 @@ var LdapWizard = {
'&ldap_serverconfig_chooser='+
encodeURIComponent($('#ldap_serverconfig_chooser').val());
//runs in the background, no callbacks necessary
- LdapWizard.ajax(param, LdapWizard.applyChanges, function(){});
+ LdapWizard.ajax(param, LdapWizard.applyChanges, function(){}, 'detectEmailAttribute');
},
detectGroupMemberAssoc: function() {
@@ -362,7 +374,8 @@ var LdapWizard = {
},
function (result) {
// error handling
- }
+ },
+ 'determineGroupMemberAssoc'
);
},
@@ -395,12 +408,13 @@ var LdapWizard = {
{noneSelectedText : 'No attributes found'});
$('#ldap_loginfilter_attributes').multiselect('disable');
LdapWizard.hideSpinner('#ldap_loginfilter_attributes');
- }
+ },
+ 'determineAttributes'
);
},
findAvailableGroups: function(multisel, type) {
- if(type != 'Users' && type != 'Groups') {
+ if(type !== 'Users' && type !== 'Groups') {
return false;
}
param = 'action=determineGroupsFor'+encodeURIComponent(type)+
@@ -442,7 +456,8 @@ var LdapWizard = {
LdapWizard.userFilterAvailableGroupsHasRun = true;
LdapWizard.postInitUserFilter();
}
- }
+ },
+ 'findAvailableGroupsFor' + type
);
},
@@ -484,7 +499,8 @@ var LdapWizard = {
LdapWizard.postInitUserFilter();
}
//TODO: error handling
- }
+ },
+ 'determine' + type + 'ObjectClasses'
);
},