Commit 0d6758a9 by Munteanu Petrisor

Add register functionality without confirmation and without validation

parent 3b2b4c4d
......@@ -167,6 +167,9 @@ class API
}
}
// var_dump($response);
// die();
if ($info['http_code'] != 200) {
throw new Exception('Internal API error');
}
......@@ -871,8 +874,30 @@ class API
];
}
function RegisterUser($params) {
die($params);
function RegisterUser($params)
{
// TODO validation on backend
$data = [
"active" => true,
"admin" => false,
"password" => $params["password"],
"email" => $params["email"],
// TODO get the group id from config file
"groupID" => 32,
"contactID" => 0,
"contact" => [
"active" => true,
"address" => $params["address"],
"mobile" => $params["phone"],
"email" => $params["email"],
"firstName" => $params["firstName"],
"lastName" => $params["lastName"],
"nin" => $params["nin"],
"type" => 1
]
];
return $this->Request('POST', '/users', $data);
}
}
......
......@@ -215,7 +215,7 @@ $app->post('/inregistrare', function ($request, $response, $args) {
$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('autentificare'), 303);
}
}
}
......
......@@ -40,12 +40,12 @@
<div class="card-content login-card-content">
<div class="row">
<div class="input-field col s12">
<input placeholder="Nume" id="name" name="name" type="text"/>
<label for="name">Nume</label>
<input placeholder="Nume" id="name" name="lastName" type="text"/>
<label for="lastName">Nume</label>
</div>
<div class="input-field col s12">
<input placeholder="Prenume" id="surname" name="surname" type="text"/>
<label for="surname">Prenume</label>
<input placeholder="Prenume" id="surname" name="firstName" type="text"/>
<label for="firstName">Prenume</label>
</div>
<div class="input-field col s12">
<input placeholder="Adresa" id="address" name="address" type="text"/>
......@@ -58,8 +58,8 @@
</div>
<div class="input-field col s12">
<input placeholder="CNP" id="cnp" name="cnp" type="text"/>
<label for="cnp">CNP</label>
<input placeholder="CNP" id="cnp" name="nin" type="text"/>
<label for="nin">CNP</label>
</div>
<div class="input-field col s12">
......
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