summaryrefslogtreecommitdiffstats
path: root/settings/js/users/users.js
diff options
context:
space:
mode:
Diffstat (limited to 'settings/js/users/users.js')
-rw-r--r--settings/js/users/users.js65
1 files changed, 30 insertions, 35 deletions
diff --git a/settings/js/users/users.js b/settings/js/users/users.js
index 5e0c0cac189..1bca6d06b33 100644
--- a/settings/js/users/users.js
+++ b/settings/js/users/users.js
@@ -292,7 +292,7 @@ var UserList = {
},
initDeleteHandling: function() {
//set up handler
- UserDeleteHandler = new DeleteHandler('removeuser.php', 'username',
+ UserDeleteHandler = new DeleteHandler('/settings/users/users', 'username',
UserList.markRemove, UserList.remove);
//configure undo
@@ -326,7 +326,7 @@ var UserList = {
UserList.currentGid = gid;
var pattern = filter.getPattern();
$.get(
- OC.generateUrl('/settings/ajax/userlist'),
+ OC.generateUrl('/settings/users/users'),
{ offset: UserList.offset, limit: UserList.usersToLoad, gid: gid, pattern: pattern },
function (result) {
var loadedUsers = 0;
@@ -667,49 +667,44 @@ $(document).ready(function () {
var groups = $('#newusergroups').val();
$('#newuser').get(0).reset();
$.post(
- OC.filePath('settings', 'ajax', 'createuser.php'),
+ OC.generateUrl('/settings/users/users'),
{
username: username,
password: password,
groups: groups
},
function (result) {
- if (result.status !== 'success') {
- OC.dialogs.alert(result.data.message,
- t('settings', 'Error creating user'));
- } else {
- if (result.data.groups) {
- var addedGroups = result.data.groups;
- for (var i in result.data.groups) {
- var gid = result.data.groups[i];
- if(UserList.availableGroups.indexOf(gid) === -1) {
- UserList.availableGroups.push(gid);
- }
- $li = GroupList.getGroupLI(gid);
- userCount = GroupList.getUserCount($li);
- GroupList.setUserCount($li, userCount + 1);
+ if (result.groups) {
+ for (var i in result.groups) {
+ var gid = result.groups[i];
+ if(UserList.availableGroups.indexOf(gid) === -1) {
+ UserList.availableGroups.push(gid);
}
+ $li = GroupList.getGroupLI(gid);
+ userCount = GroupList.getUserCount($li);
+ GroupList.setUserCount($li, userCount + 1);
}
- if (result.data.homeExists){
- OC.Notification.hide();
- OC.Notification.show(t('settings', 'Warning: Home directory for user "{user}" already exists', {user: result.data.username}));
- if (UserList.notificationTimeout){
- window.clearTimeout(UserList.notificationTimeout);
- }
- UserList.notificationTimeout = window.setTimeout(
- function(){
- OC.Notification.hide();
- UserList.notificationTimeout = null;
- }, 10000);
- }
- if(!UserList.has(username)) {
- UserList.add(username, username, result.data.groups, null, 'default', result.data.storageLocation, 0, true);
+ }
+ if (result.homeExists){
+ OC.Notification.hide();
+ OC.Notification.show(t('settings', 'Warning: Home directory for user "{user}" already exists', {user: result.username}));
+ if (UserList.notificationTimeout){
+ window.clearTimeout(UserList.notificationTimeout);
}
- $('#newusername').focus();
- GroupList.incEveryoneCount();
+ UserList.notificationTimeout = window.setTimeout(
+ function(){
+ OC.Notification.hide();
+ UserList.notificationTimeout = null;
+ }, 10000);
}
- }
- );
+ if(!UserList.has(username)) {
+ UserList.add(username, username, result.groups, null, 'default', result.storageLocation, 0, true);
+ }
+ $('#newusername').focus();
+ GroupList.incEveryoneCount();
+ }).fail(function(result, textStatus, errorThrown) {
+ OC.dialogs.alert(result.responseJSON.message, t('settings', 'Error creating user'));
+ });
});
// Option to display/hide the "Storage location" column