[Ivan Diaz] - Add signup controller

This commit is contained in:
Ivan Diaz 2016-03-04 20:51:59 -03:00
parent 18d0818806
commit 400de7e480
2 changed files with 22 additions and 17 deletions

View File

@ -3,7 +3,6 @@
class LoginController extends Controller { class LoginController extends Controller {
const PATH = '/login'; const PATH = '/login';
public function handler() { public function handler() {
$email = Controller::request('email'); $email = Controller::request('email');
$password = Controller::request('password'); $password = Controller::request('password');
@ -20,4 +19,4 @@ class LoginController extends Controller {
} }
} }
$controllerGroup->addController(new LoginController()); $controllerGroup->addController(new LoginController);

View File

@ -1,18 +1,24 @@
<?php <?php
/*$controllerGroup->addController('/signup', function () {
$email = Controller::request('email');
$password = Controller::request('password');
$userInstance = new User(); class SignUpController extends Controller {
$userInstance->setProperties(array( const PATH = '/signup';
'email' => $email,
'password' => $password,
'admin' => 0
));
$id = $userInstance->store();
Response::respondSuccess(array( public function handler() {
'id' => $id $email = Controller::request('email');
)); $password = Controller::request('password');
});
*/ $userInstance = new User();
$userInstance->setProperties(array(
'email' => $email,
'password' => $password,
'admin' => 0
));
$id = $userInstance->store();
Response::respondSuccess(array(
'id' => $id
));
}
}
$controllerGroup->addController(new SignUpController);