diff --git a/app/library/App/Controllers/UserController.php b/app/library/App/Controllers/UserController.php index c4d68cd..47a1e07 100755 --- a/app/library/App/Controllers/UserController.php +++ b/app/library/App/Controllers/UserController.php @@ -36,61 +36,16 @@ class UserController extends CrudResourceController public function register() { - $data = $this->getPostedData(); + $this->create(); - if (!$data || count($data) == 0) { - return $this->onNoDataProvided(); - } - - if (!$this->postDataValid($data, false)) { - return $this->onDataInvalid($data); - } - - if (!$this->saveAllowed($data) || !$this->createAllowed($data)) { - return $this->onNotAllowed(); - } - - $data = $this->transformPostData($data); - - $item = $this->createModelInstance(); - - //$newItem = $this->createItem($item, $data); - $item->assign($data, null, $this->whitelistCreate()); - $this->afterAssignData($item, $data); - - $this->beforeSave($item); - $this->beforeCreate($item); - - $success = $item->create(); - - if ($success) { - - $this->afterCreate($item); - $this->afterSave($item); - } - - $newItem = $success ? $item : null; - - if (!$newItem) { - return $this->onCreateFailed($item, $data); - } - - die(var_dump($newItem)); - - $primaryKey = $this->getModelPrimaryKey(); - $responseData = $this->getFindData($newItem->$primaryKey); - - $response = $this->getCreateResponse($responseData, $data); - - return $response; } public function whitelist() { return [ - 'firstName', - 'lastName', - 'password' + 'username', + 'password', + 'email' ]; } } -- libgit2 0.21.4