]> source.dussan.org Git - nextcloud-server.git/commitdiff
Fixed user dir existence check when creating new user
authorVincent Petry <pvince81@owncloud.com>
Fri, 25 Oct 2013 14:23:29 +0000 (16:23 +0200)
committerVincent Petry <pvince81@owncloud.com>
Fri, 25 Oct 2013 14:23:29 +0000 (16:23 +0200)
The check was done too later. It turns out that createUser() had already
created the dir, which caused the warning message to be shown every
time.

settings/ajax/createuser.php

index 915fcaf2d428843a6ca2248618cc5554f4139a4e..94b56fa03494667f993144e09402fde30d0757b6 100644 (file)
@@ -28,6 +28,10 @@ $password = $_POST["password"];
 
 // Return Success story
 try {
+       // check whether the user's files home exists
+       $userDirectory = OC_User::getHome($username) . '/files/';
+       $homeExists = file_exists($userDirectory);
+
        if (!OC_User::createUser($username, $password)) {
                OC_JSON::error(array('data' => array( 'message' => 'User creation failed for '.$username )));
                exit();
@@ -39,10 +43,6 @@ try {
                OC_Group::addToGroup( $username, $i );
        }
 
-       // check whether the user's files home exists
-       $userDirectory = OC_User::getHome($username) . '/files/';
-       $homeExists = file_exists($userDirectory);
-
        OC_JSON::success(array("data" =>
                                array(
                                        // returns whether the home already existed