summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-11-14 21:44:44 +0100
committerBart Visscher <bartv@thisnet.nl>2012-11-14 21:52:28 +0100
commit59627367ae4ba41c84f14e55ef4fe57c2924b7ab (patch)
treea1a7937912a1097c87ac164593ae5f4f64e130e5 /settings
parent4eff27ed421205d6627e96203e03516666125b70 (diff)
downloadnextcloud-server-59627367ae4ba41c84f14e55ef4fe57c2924b7ab.tar.gz
nextcloud-server-59627367ae4ba41c84f14e55ef4fe57c2924b7ab.zip
Better check and handling of user creation
Diffstat (limited to 'settings')
-rw-r--r--settings/ajax/createuser.php7
1 files changed, 5 insertions, 2 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);