|
@@ -55,12 +55,7 @@ class SecurityController extends AbstractController
|
|
|
$form->handleRequest($request);
|
|
|
if ($form->isSubmitted() && $form->isValid())
|
|
|
{
|
|
|
- $encoded = $encoder->encodePassword($user, $user->getPassword());
|
|
|
- $user->setPassword($encoded);
|
|
|
- $userManager->generateToken($user);
|
|
|
- $em = $this->getDoctrine()->getManager();
|
|
|
- $em->persist($user);
|
|
|
- $em->flush();
|
|
|
+ $userManager->enregistrerUser($user);
|
|
|
$this->addFlash('success', 'L\'utilisateur a été ajouté');
|
|
|
return $this->redirectToRoute('admin_index');
|
|
|
}
|
|
@@ -72,13 +67,12 @@ class SecurityController extends AbstractController
|
|
|
/**
|
|
|
* @Route("/admin/edituser/{id}", name="admin_edituser")
|
|
|
*/
|
|
|
- public function editUserAction(Request $request, UserPasswordEncoderInterface $encoder, User $user)
|
|
|
+ public function editUserAction(Request $request, User $user, EntityManagerInterface $em)
|
|
|
{
|
|
|
$form = $this->createForm(UserEditType::class, $user);
|
|
|
$form->handleRequest($request);
|
|
|
if ($form->isSubmitted() && $form->isValid())
|
|
|
{
|
|
|
- $em = $this->getDoctrine()->getManager();
|
|
|
$em->flush();
|
|
|
$this->addFlash('success', 'L\'utilisateur a été modifié');
|
|
|
return $this->redirectToRoute('admin_index');
|