Commit 95d1b70cb2a970cc6d1f834ed43f50c82da2c61c

Authored by Alex Savenko
1 parent 3582f649

registration

Showing 1 changed file with 33 additions and 1 deletions   Show diff stats
app/library/App/Controllers/UserController.php
... ... @@ -34,7 +34,39 @@ class UserController extends CrudResourceController
34 34 }
35 35  
36 36 public function register() {
37   - parent::create();
  37 +
  38 + $data = $this->getPostedData();
  39 +
  40 + if (!$data || count($data) == 0) {
  41 + return $this->onNoDataProvided();
  42 + }
  43 +
  44 + if (!$this->postDataValid($data, false)) {
  45 + return $this->onDataInvalid($data);
  46 + }
  47 +
  48 + if (!$this->saveAllowed($data) || !$this->createAllowed($data)) {
  49 + return $this->onNotAllowed();
  50 + }
  51 +
  52 + $data = $this->transformPostData($data);
  53 +
  54 + die($data);
  55 +
  56 + $item = $this->createModelInstance();
  57 +
  58 + $newItem = $this->createItem($item, $data);
  59 +
  60 + if (!$newItem) {
  61 + return $this->onCreateFailed($item, $data);
  62 + }
  63 +
  64 + $primaryKey = $this->getModelPrimaryKey();
  65 + $responseData = $this->getFindData($newItem->$primaryKey);
  66 +
  67 + $response = $this->getCreateResponse($responseData, $data);
  68 +
  69 + return $response;
38 70 }
39 71  
40 72 public function whitelist()
... ...