Merge branch 'dev/user-bugfix' into 'develop'

Fix user creation bug

See merge request easy-solutions/apps/easyportal!52
This commit is contained in:
Charles-Edouard MARGUERITE 2026-03-04 08:07:54 +00:00
commit 91304d95dc
1 changed files with 4 additions and 3 deletions

View File

@ -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]);
// CASE A: User exists -> Add to org
if ($existingUser) {
if($this->userService->checkUserOrganizationLinkExists($existingUser, $org)){ if($this->userService->checkUserOrganizationLinkExists($existingUser, $org)){
return $this->json(['error' => "L'utilisateur existe déjà dans votre organisation"], 400); return $this->json(['error' => "L'utilisateur existe déjà dans votre organisation"], 400);
} }
// CASE A: User exists -> Add to org
if ($existingUser) {
// 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);