[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 {
const PATH = '/login';
public function handler() {
$email = Controller::request('email');
$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
/*$controllerGroup->addController('/signup', function () {
$email = Controller::request('email');
$password = Controller::request('password');
$userInstance = new User();
$userInstance->setProperties(array(
'email' => $email,
'password' => $password,
'admin' => 0
));
$id = $userInstance->store();
class SignUpController extends Controller {
const PATH = '/signup';
Response::respondSuccess(array(
'id' => $id
));
});
*/
public function handler() {
$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);