Validate that username/password is not empty

This commit is contained in:
wpetit 2020-03-09 10:14:55 +01:00
parent 07f0960c8c
commit a17262e81e

View File

@ -96,12 +96,12 @@ class UserController extends Controller
$newUser = new User(); $newUser = new User();
if (!isset($projectData['username'])) { if (!isset($projectData['username']) || empty($projectData['username'])) {
return new ErrorResponse(0, "You must provide a username"); return new ErrorResponse(0, "You must provide a username");
} }
$newUser->setUsername($projectData['username']); $newUser->setUsername($projectData['username']);
if (!isset($projectData['password'])) { if (!isset($projectData['password']) || empty($projectData['password'])) {
return new ErrorResponse(1, "You must provide a password"); return new ErrorResponse(1, "You must provide a password");
} }
$newUser->setPassword($passwordEncoder->encodePassword( $newUser->setPassword($passwordEncoder->encodePassword(