bug correction user creation
This commit is contained in:
parent
e33b0b8248
commit
febd2ad6b2
|
|
@ -124,11 +124,10 @@ class UserController extends AbstractController
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
// Handle file upload
|
// Handle file upload
|
||||||
$logoFile = $form->get('pictureUrl')->getData();
|
$picture = $form->get('pictureUrl')->getData();
|
||||||
|
|
||||||
if ($logoFile) {
|
|
||||||
$this->userService->handleProfilePicture($user, $logoFile);
|
|
||||||
|
|
||||||
|
if ($picture) {
|
||||||
|
$this->userService->handleProfilePicture($user, $picture);
|
||||||
}
|
}
|
||||||
$user->setModifiedAt(new \DateTimeImmutable('now'));
|
$user->setModifiedAt(new \DateTimeImmutable('now'));
|
||||||
$this->entityManager->persist($user);
|
$this->entityManager->persist($user);
|
||||||
|
|
@ -156,14 +155,16 @@ class UserController extends AbstractController
|
||||||
$form = $this->createForm(UserForm::class, $user);
|
$form = $this->createForm(UserForm::class, $user);
|
||||||
$form->handleRequest($request);
|
$form->handleRequest($request);
|
||||||
|
|
||||||
|
|
||||||
if ($form->isSubmitted() && $form->isValid()) {
|
if ($form->isSubmitted() && $form->isValid()) {
|
||||||
$orgId = $request->query->get('organizationId');
|
$orgId = $request->query->get('organizationId');
|
||||||
// Handle file upload
|
// Handle file upload
|
||||||
$logoFile = $form->get('pictureUrl')->getData();
|
$picture = $form->get('pictureUrl')->getData();
|
||||||
|
|
||||||
if ($logoFile) {
|
|
||||||
$this->userService->handleProfilePicture($user, $logoFile);
|
|
||||||
|
|
||||||
|
if ($picture) {
|
||||||
|
$this->userService->handleProfilePicture($user, $picture);
|
||||||
|
}else{
|
||||||
|
$user->setPictureUrl("");
|
||||||
}
|
}
|
||||||
if ($orgId) {
|
if ($orgId) {
|
||||||
$org = $this->entityManager->getRepository(Organizations::class)->find($orgId);
|
$org = $this->entityManager->getRepository(Organizations::class)->find($orgId);
|
||||||
|
|
@ -175,13 +176,14 @@ class UserController extends AbstractController
|
||||||
$this->actionService->createAction("Create new user", $user, $orgId, $user->getUserIdentifier()." for organization ".$org->getName());
|
$this->actionService->createAction("Create new user", $user, $orgId, $user->getUserIdentifier()." for organization ".$org->getName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else{
|
$this->actionService->createAction("Create new user", $actingUser, null, $user->getUserIdentifier());
|
||||||
$this->actionService->createAction("Create new user", $actingUser, null, $user->getUserIdentifier());
|
|
||||||
}
|
//FOR TEST PURPOSES, SETTING A DEFAULT RANDOM PASSWORD
|
||||||
|
$user->setPassword($this->userService->generateRandomPassword());
|
||||||
|
$this->entityManager->persist($user);
|
||||||
$this->entityManager->flush();
|
$this->entityManager->flush();
|
||||||
|
|
||||||
|
return $this->redirectToRoute('user_index');
|
||||||
return $this->redirectToRoute('user_show', ['id' => $user->getId()]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->render('user/new.html.twig', [
|
return $this->render('user/new.html.twig', [
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue