|
@@ -21,6 +21,11 @@ class RegisterController
|
|
|
{
|
|
{
|
|
|
$body = json_decode((string) $request->getBody(), true) ?? [];
|
|
$body = json_decode((string) $request->getBody(), true) ?? [];
|
|
|
|
|
|
|
|
|
|
+ $companyId = (int)($request->getAttribute('api_company_id') ?? 0);
|
|
|
|
|
+ if ($companyId <= 0) {
|
|
|
|
|
+ return ResponseLib::sendFail('Authenticated company not found', [], 'E_VALIDATE')->withStatus(401);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
try {
|
|
try {
|
|
|
val::key('username', val::stringType()->notEmpty()->length(1, 100))
|
|
val::key('username', val::stringType()->notEmpty()->length(1, 100))
|
|
|
->key('email', val::email())
|
|
->key('email', val::email())
|
|
@@ -33,12 +38,13 @@ class RegisterController
|
|
|
->key('country', val::stringType()->notEmpty()->length(1, 100))
|
|
->key('country', val::stringType()->notEmpty()->length(1, 100))
|
|
|
->key('birthdate', val::intType())
|
|
->key('birthdate', val::intType())
|
|
|
->key('cpf', val::stringType()->notEmpty()->length(1, 50))
|
|
->key('cpf', val::stringType()->notEmpty()->length(1, 50))
|
|
|
- ->key('company_id', val::intType()->positive())
|
|
|
|
|
->assert($body);
|
|
->assert($body);
|
|
|
} catch (ValidationException $e) {
|
|
} catch (ValidationException $e) {
|
|
|
return ResponseLib::sendFail("Validation failed: " . $e->getFullMessage(), [], "E_VALIDATE")->withStatus(400);
|
|
return ResponseLib::sendFail("Validation failed: " . $e->getFullMessage(), [], "E_VALIDATE")->withStatus(400);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ $body['company_id'] = $companyId;
|
|
|
|
|
+
|
|
|
$body['kyc'] = 0;
|
|
$body['kyc'] = 0;
|
|
|
$body['role_id'] = 2;
|
|
$body['role_id'] = 2;
|
|
|
|
|
|