Commit e8cab5b793c3c7296eba9863c066fa17e47eed13

Authored by Alex Savenko
1 parent 0f3b3960

test

Showing 1 changed file with 20 additions and 1 deletions   Show diff stats
app/library/App/Controllers/UserController.php
... ... @@ -46,7 +46,26 @@ class UserController extends CrudResourceController
46 46  
47 47 public function registration() {
48 48  
49   - return parent::create();
  49 + $data = $this->getPostedData();
  50 +
  51 + if (!$data || count($data) == 0) {
  52 + return $this->onNoDataProvided();
  53 + }
  54 +
  55 + if (!$this->postDataValid($data, false)) {
  56 + return $this->onDataInvalid($data);
  57 + }
  58 +
  59 + if (!$this->saveAllowed($data) || !$this->createAllowed($data)) {
  60 + return $this->onNotAllowed();
  61 + }
  62 +
  63 + $data = $this->transformPostData($data);
  64 +
  65 + $user = new User();
  66 + $user->name = $data['name'];
  67 + $user->pass = $data['pass'];
  68 + $user->save();
50 69  
51 70 }
52 71  
... ...