Advertisement
Guest User

Untitled

a guest
Oct 13th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. public function mainAction(Request $request)
  2. {
  3. $user = $this->getUser();
  4.  
  5. $form = $this->createForm(UserType::class, $user);
  6.  
  7. $form->handleRequest($request);
  8. if ($form->isValid() && $form->isSubmitted()) {
  9. $password = $this->get('security.password_encoder')
  10. ->encodePassword($user, $user->getPlainPassword());
  11. $user->setPassword($password);
  12. $em = $this->getDoctrine()->getEntityManager();
  13. $em->persist($user);
  14. $em->flush();
  15. }
  16.  
  17. return $this->render('AppBundle:uzduotis:index.html.twig', [
  18. 'form' => $form->createView(),
  19. 'user' => $user
  20. ]);
  21. }
  22.  
  23. * @Route("/logout", name="logout")
  24. * @Method({"GET"})
  25. */
  26. public function logoutAction(Request $request)
  27. {
  28. $session = $this->$request->getSession();
  29. $session = $this->get('session')->clear();
  30. return $this->render('AppBundle:uzduotis:login.html.twig');
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement