src/Base/Controller/Panel/AuthController.php line 19

  1. <?php
  2. /**
  3.  * Created by PhpStorm.
  4.  * User: Shokhaa
  5.  * Date: 18/11/22
  6.  * Time: 14:04
  7.  */
  8. namespace App\Base\Controller\Panel;
  9. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  10. use Symfony\Component\HttpFoundation\Response;
  11. use Symfony\Component\Routing\Annotation\Route;
  12. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  13. class AuthController extends AbstractController
  14. {
  15.     #[Route('/login'name'app_login')]
  16.     public function index(AuthenticationUtils $authenticationUtils): Response
  17.     {
  18.         if ($this->getUser()) {
  19.             return $this->redirect('/');
  20.         }
  21.         return $this->render('login/index.html.twig', [
  22.             'last_username' => $authenticationUtils->getLastUsername(),
  23.             'error'         => $authenticationUtils->getLastAuthenticationError(),
  24.         ]);
  25.     }
  26.     #[Route('/logout'name'app_logout'methods: ['GET''POST'])]
  27.     public function logout()
  28.     {
  29.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  30.     }
  31.     #[Route('/'name'home')]
  32.     public function home()
  33.     {
  34.         return $this->redirect('/flower');
  35.     }
  36. }