src/Controller/defaultController.php line 19

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use App\Document\User;
  4. use Doctrine\ODM\MongoDB\DocumentManager;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\HttpFoundation\JsonResponse;
  7. use Symfony\Component\HttpFoundation\Request;
  8. use Symfony\Component\HttpFoundation\Response;
  9. use Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface;
  10. use Symfony\Component\Routing\Annotation\Route;
  11. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  12. class defaultController extends AbstractController
  13. {
  14.     /**
  15.      * @Route("/", name="welcome", methods={"GET"})
  16.      */
  17.     public function welcome(Request $requestDocumentManager $dm): Response
  18.     {
  19.         $this->denyAccessUnlessGranted('IS_AUTHENTICATED_FULLY');
  20.         $user $this->getUser();
  21.         return $this->render('layout.html.twig');
  22.     }
  23.     /**
  24.      * @Route("/login", name="app_login")
  25.      */
  26.     public function login(AuthenticationUtils $authenticationUtils): Response
  27.     {
  28.         $error $authenticationUtils->getLastAuthenticationError();
  29.         $lastUsername $authenticationUtils->getLastUsername();
  30.         return $this->render('Account/login.html.twig', array(
  31.             'last_username' => $lastUsername,
  32.             'error'         => $error,
  33.         ));
  34.     }
  35.     /**
  36.      * @Route("/logout", name="app_logout")
  37.      */
  38.     public function logout(): void
  39.     {
  40.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  41.     }
  42. }