diff options
author | Michael Gapczynski <GapczynskiM@gmail.com> | 2012-05-06 18:04:31 -0400 |
---|---|---|
committer | Michael Gapczynski <GapczynskiM@gmail.com> | 2012-05-06 18:04:48 -0400 |
commit | e0db22cc0741abaebe44e245f2da6ca1a34f7cac (patch) | |
tree | 94d9765246bb305d0b34b194e7d0edaa61fec3f2 /settings/ajax/createuser.php | |
parent | 333345d20190212200b10ae01d925807e1b10ece (diff) | |
download | nextcloud-server-e0db22cc0741abaebe44e245f2da6ca1a34f7cac.tar.gz nextcloud-server-e0db22cc0741abaebe44e245f2da6ca1a34f7cac.zip |
Provide feedback when user creation fails
Diffstat (limited to 'settings/ajax/createuser.php')
-rw-r--r-- | settings/ajax/createuser.php | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/settings/ajax/createuser.php b/settings/ajax/createuser.php index 1ed53efcf06..6714711bc87 100644 --- a/settings/ajax/createuser.php +++ b/settings/ajax/createuser.php @@ -23,7 +23,8 @@ if( in_array( $username, OC_User::getUsers())){ } // Return Success story -if( OC_User::createUser( $username, $password )){ +try { + OC_User::createUser($username, $password); foreach( $groups as $i ){ if(!OC_Group::groupExists($i)){ OC_Group::createGroup($i); @@ -31,9 +32,8 @@ if( OC_User::createUser( $username, $password )){ OC_Group::addToGroup( $username, $i ); } OC_JSON::success(array("data" => array( "username" => $username, "groups" => implode( ", ", OC_Group::getUserGroups( $username ))))); -} -else{ - OC_JSON::error(array("data" => array( "message" => "Unable to add user" ))); +} catch (Exception $exception) { + OC_JSON::error(array("data" => array( "message" => $exception->getMessage()))); } ?> |