Commit 3b2b4c4d by Munteanu Petrisor

Add register post route

parent 1726d487
......@@ -870,6 +870,10 @@ class API
3 => 'UNEJ'
];
}
function RegisterUser($params) {
die($params);
}
}
?>
......@@ -196,6 +196,35 @@ $app->get('/inregistrare', function ($request, $response, $args) {
})->setName('inregistrare');
$app->post('/inregistrare', function ($request, $response, $args) {
if (!$this->session->exists('user_id')) {
$api = new API($this);
if (empty($args)) {
$args = array();
}
$params = $request->getParsedBody();
if (!empty($params)) {
$res = $api->RegisterUser($params);
if (!empty($res)) {
if ($res['info']['http_code'] !== 200) {
$this->flash->addMessage("error", "Inregistrarea a esuat");
return $response->withRedirect($this->router->pathFor('inregistrare'), 303);
} else {
return $response->withRedirect($this->router->pathFor('home'), 303);
}
}
}
}
return $response->withRedirect($this->router->pathFor('home'), 303);
})->setName('inregistrare');
$app->post('/autentificare', function ($request, $response, $args) {
$api = new API($this);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment