Fixed user dir existence check when creating new user

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.
This commit is contained in:
Vincent Petry 2013-10-25 16:23:29 +02:00
parent 3fc232370e
commit 1ee4b680f6

View file

@ -28,6 +28,10 @@ $password = $_POST["password"];
// Return Success story // Return Success story
try { 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)) { if (!OC_User::createUser($username, $password)) {
OC_JSON::error(array('data' => array( 'message' => 'User creation failed for '.$username ))); OC_JSON::error(array('data' => array( 'message' => 'User creation failed for '.$username )));
exit(); exit();
@ -39,10 +43,6 @@ try {
OC_Group::addToGroup( $username, $i ); 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" => OC_JSON::success(array("data" =>
array( array(
// returns whether the home already existed // returns whether the home already existed