Fix user creation bug
This commit is contained in:
parent
3200d05ed6
commit
edf91ae01d
|
|
@ -872,11 +872,12 @@ class UserController extends AbstractController
|
||||||
$email = $user->getEmail();
|
$email = $user->getEmail();
|
||||||
$existingUser = $this->userRepository->findOneBy(['email' => $email]);
|
$existingUser = $this->userRepository->findOneBy(['email' => $email]);
|
||||||
|
|
||||||
if($this->userService->checkUserOrganizationLinkExists($existingUser, $org)){
|
|
||||||
return $this->json(['error' => "L'utilisateur existe déjà dans votre organisation"], 400);
|
|
||||||
}
|
|
||||||
// CASE A: User exists -> Add to org
|
// CASE A: User exists -> Add to org
|
||||||
if ($existingUser) {
|
if ($existingUser) {
|
||||||
|
if($this->userService->checkUserOrganizationLinkExists($existingUser, $org)){
|
||||||
|
return $this->json(['error' => "L'utilisateur existe déjà dans votre organisation"], 400);
|
||||||
|
}
|
||||||
// Check if already in org to avoid logic errors or duplicate logs
|
// Check if already in org to avoid logic errors or duplicate logs
|
||||||
$this->userService->addExistingUserToOrganization($existingUser, $org, $selectedApps);
|
$this->userService->addExistingUserToOrganization($existingUser, $org, $selectedApps);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue