From f9604a21c77599d678d74e360c60c90c09775575 Mon Sep 17 00:00:00 2001 From: Vitor Mattos Date: Mon, 24 Feb 2025 19:35:57 -0300 Subject: [PATCH] chore: allow to always check if need to update user data Signed-off-by: Vitor Mattos --- lib/Controller/AdminGroupController.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lib/Controller/AdminGroupController.php b/lib/Controller/AdminGroupController.php index c553d5f..afc8541 100644 --- a/lib/Controller/AdminGroupController.php +++ b/lib/Controller/AdminGroupController.php @@ -165,14 +165,13 @@ private function addSubAdmin(IUser $user, IGroup $group): void { private function createUser($userId, $displayName, $email): IUser { $user = $this->userManager->get($userId); - if ($user instanceof IUser) { - return $user; - } - $passwordEvent = new GenerateSecurePasswordEvent(); - $this->eventDispatcher->dispatchTyped($passwordEvent); - $password = $passwordEvent->getPassword() ?? $this->secureRandom->generate(20); + if (!$user instanceof IUser) { + $passwordEvent = new GenerateSecurePasswordEvent(); + $this->eventDispatcher->dispatchTyped($passwordEvent); + $password = $passwordEvent->getPassword() ?? $this->secureRandom->generate(20); - $user = $this->userManager->createUser($userId, $password); + $user = $this->userManager->createUser($userId, $password); + } if ($displayName !== '') { try {