src/Controller/LoginController.php line 17

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Controller;
  4. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  5. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  6. use Symfony\Component\HttpFoundation\{ResponseRedirectResponse};
  7. use Symfony\Component\Routing\Annotation\Route;
  8. class LoginController extends AbstractController
  9. {
  10.     #[Route('/login'name'login')]
  11.     public function index(AuthenticationUtils $authenticationUtils): Response
  12.     {
  13.         $error $authenticationUtils->getLastAuthenticationError();
  14.         $lastUsername $authenticationUtils->getLastUsername();
  15.         return $this->render('login/index.html.twig', [
  16.             'last_username' => $lastUsername,
  17.             'error'         => $error,
  18.         ]);
  19.     }
  20.     #[Route('/logout'name'logout')]
  21.     public function logout(): void
  22.     {
  23.     }
  24.     #[Route('/login-success'name'login_success')]
  25.     public function loginSuccess(): RedirectResponse
  26.     {
  27.         if(true === $this->isGranted('ROLE_CUSTOMER')) {
  28.             return $this->redirectToRoute('customer_homepage');
  29.         }
  30.         
  31.         return $this->redirectToRoute('campaign_my_campaigns_index');
  32.     }
  33. }