Skip to content
Snippets Groups Projects
Commit d14cdc20 authored by Guillaume Heurtier's avatar Guillaume Heurtier
Browse files

FEAT #11645 TIME 0:10 check phone format only if user has privilege in create as well

parent 51c8270d
No related branches found
No related tags found
No related merge requests found
......@@ -149,7 +149,11 @@ class UserController
$check = $check && Validator::stringType()->notEmpty()->validate($data['firstname']);
$check = $check && Validator::stringType()->notEmpty()->validate($data['lastname']);
$check = $check && (empty($data['mail']) || filter_var($data['mail'], FILTER_VALIDATE_EMAIL));
$check = $check && (empty($data['phone']) || preg_match("/\+?((|\ |\.|\(|\)|\-)?(\d)*)*\d$/", $data['phone']));
if (PrivilegeController::hasPrivilege(['privilegeId' => 'manage_personal_data', 'userId' => $GLOBALS['id']])) {
$check = $check && (empty($data['phone']) || preg_match("/\+?((|\ |\.|\(|\)|\-)?(\d)*)*\d$/", $data['phone']));
}
if (!$check) {
return $response->withStatus(400)->withJson(['errors' => 'Bad Request']);
}
......
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