diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2012-11-15 14:01:16 -0800 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2012-11-15 14:01:16 -0800 |
commit | 36bf4e24f0ea910ce504a5756279f9f73619694d (patch) | |
tree | de36a07c7c979bf4efd7f4e75cfa538a29853dad /settings | |
parent | 8a93cc14f66b6d2d725ae52ce0bf632a03fac59d (diff) | |
parent | 9419913c06bc0fc7795243d9a9f8800f5e2a7ac4 (diff) | |
download | nextcloud-server-36bf4e24f0ea910ce504a5756279f9f73619694d.tar.gz nextcloud-server-36bf4e24f0ea910ce504a5756279f9f73619694d.zip |
Merge pull request #433 from owncloud/user_setting_fixes
User setting fixes
Diffstat (limited to 'settings')
-rw-r--r-- | settings/ajax/createuser.php | 7 | ||||
-rw-r--r-- | settings/js/users.js | 23 |
2 files changed, 14 insertions, 16 deletions
diff --git a/settings/ajax/createuser.php b/settings/ajax/createuser.php index 16b48c8a9ca..addae78517a 100644 --- a/settings/ajax/createuser.php +++ b/settings/ajax/createuser.php @@ -29,14 +29,17 @@ $username = $_POST["username"]; $password = $_POST["password"]; // Does the group exist? -if( in_array( $username, OC_User::getUsers())) { +if(OC_User::userExists($username)) { OC_JSON::error(array("data" => array( "message" => "User already exists" ))); exit(); } // Return Success story try { - OC_User::createUser($username, $password); + if (!OC_User::createUser($username, $password)) { + OC_JSON::error(array('data' => array( 'message' => 'User creation failed for '.$username ))); + exit(); + } foreach( $groups as $i ) { if(!OC_Group::groupExists($i)) { OC_Group::createGroup($i); diff --git a/settings/js/users.js b/settings/js/users.js index 249d529df4f..517984f9247 100644 --- a/settings/js/users.js +++ b/settings/js/users.js @@ -29,7 +29,6 @@ var UserList={ $('#notification').html(t('users', 'deleted')+' '+uid+'<span class="undo">'+t('users', 'undo')+'</span>'); $('#notification').data('deleteuser',true); $('#notification').fadeIn(); - }, /** @@ -57,10 +56,11 @@ var UserList={ $('#notification').fadeOut(); $('tr').filterAttr('data-uid', UserList.deleteUid).remove(); UserList.deleteCanceled = true; - UserList.deleteFiles = null; if (ready) { ready(); } + } else { + oc.dialogs.alert(result.data.message, t('settings', 'Unable to remove user')); } } }); @@ -69,7 +69,7 @@ var UserList={ add:function(username, groups, subadmin, quota, sort) { var tr = $('tbody tr').first().clone(); - tr.data('uid', username); + tr.attr('data-uid', username); tr.find('td.name').text(username); var groupsSelect = $('<select multiple="multiple" class="groupsselect" data-placehoder="Groups" title="Groups">'); groupsSelect.data('username', username); @@ -123,7 +123,7 @@ var UserList={ if (sort) { username = username.toLowerCase(); $('tbody tr').each(function() { - if (username < $(this).data('uid').toLowerCase()) { + if (username < $(this).attr('data-uid').toLowerCase()) { $(tr).insertBefore($(this)); added = true; return false; @@ -267,7 +267,7 @@ $(document).ready(function(){ $('td.remove>a').live('click',function(event){ var row = $(this).parent().parent(); - var uid = $(row).data('uid'); + var uid = $(row).attr('data-uid'); $(row).hide(); // Call function for handling delete/undo UserList.do_delete(uid); @@ -276,7 +276,7 @@ $(document).ready(function(){ $('td.password>img').live('click',function(event){ event.stopPropagation(); var img=$(this); - var uid=img.parent().parent().data('uid'); + var uid=img.parent().parent().attr('data-uid'); var input=$('<input type="password">'); img.css('display','none'); img.parent().children('span').replaceWith(input); @@ -306,7 +306,7 @@ $(document).ready(function(){ $('select.quota, select.quota-user').live('change',function(){ var select=$(this); - var uid=$(this).parent().parent().parent().data('uid'); + var uid=$(this).parent().parent().parent().attr('data-uid'); var quota=$(this).val(); var other=$(this).next(); if(quota!='other'){ @@ -324,7 +324,7 @@ $(document).ready(function(){ }) $('input.quota-other').live('change',function(){ - var uid=$(this).parent().parent().parent().data('uid'); + var uid=$(this).parent().parent().parent().attr('data-uid'); var quota=$(this).val(); var select=$(this).prev(); var other=$(this); @@ -401,13 +401,8 @@ $(document).ready(function(){ $('#notification').hide(); $('#notification .undo').live('click', function() { if($('#notification').data('deleteuser')) { - $('tbody tr').each(function(index, row) { - if ($(row).data('uid') == UserList.deleteUid) { - $(row).show(); - } - }); + $('tbody tr').filterAttr('data-uid', UserList.deleteUid).show(); UserList.deleteCanceled=true; - UserList.deleteFiles=null; } $('#notification').fadeOut(); }); |