Skip to content
Snippets Groups Projects
Commit 2d579868 authored by Quentin Ribac's avatar Quentin Ribac
Browse files

FEAT #14837 TIME 0:15 using Validator in routes

parent b04fd019
No related branches found
No related tags found
No related merge requests found
......@@ -294,8 +294,13 @@ class MultigestController
}
$body = $request->getParsedBody();
ValidatorModel::stringType($body, ['sasId', 'login', 'password']);
ValidatorModel::notEmpty($body, ['sasId', 'login']);
if (!Validator::stringType()->notEmpty()->validate($body['sasId'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body sasId is empty or not a string']);
} elseif (!Validator::stringType()->notEmpty()->validate($body['login'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body login is empty or not a string']);
} elseif (!Validator::stringType()->validate($body['password'])) {
return $response->withStatus(400)->withJson(['errors' => 'Body password is not a string']);
}
$result = MultigestController::checkAccountWithCredentials([
'sasId' => $body['sasId'],
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment