src/Controller/LoginController.php line 20

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  4. use Symfony\Component\HttpFoundation\Response;
  5. use Symfony\Component\Routing\Annotation\Route;
  6. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  7. use Symfony\Contracts\Translation\TranslatorInterface;
  8. class LoginController extends AbstractController
  9. {
  10.     /**
  11.      * @param AuthenticationUtils $authenticationUtils
  12.      * @return Response
  13.      * @Route("/system/login", name="system_login")
  14.      */
  15.     public function adminLogin(AuthenticationUtils $authenticationUtils): Response
  16.     {        
  17.         if ($this->getUser()) {
  18.             return $this->redirectToRoute('index');
  19.         }
  20.         // get the login error if there is one
  21.         $error $authenticationUtils->getLastAuthenticationError();
  22.         // last username entered by the user
  23.         $lastUsername $authenticationUtils->getLastUsername();
  24.         return $this->render('Admin/login.html.twig', [
  25.             'last_username' => $lastUsername,
  26.             'error' => $error
  27.         ]);
  28.     }
  29.     /**
  30.      * @param AuthenticationUtils $authenticationUtils
  31.      * @return Response
  32.      * @Route("/konto/logowanie", name="store_login")
  33.      */
  34.     public function login(AuthenticationUtils $authenticationUtilsTranslatorInterface $translator): Response
  35.     {
  36.         if ($this->getUser()) {
  37.             return $this->redirectToRoute('index');
  38.         }
  39.         $title $translator->trans('Login to store');
  40.         // get the login error if there is one
  41.         $error $authenticationUtils->getLastAuthenticationError();
  42.         // last username entered by the user
  43.         $lastUsername $authenticationUtils->getLastUsername();
  44.         return $this->render('Store/'.$this->storeData['storeTheme'].'/UserAccount/login.html.twig', [
  45.             'last_username' => $lastUsername,
  46.             'error' => $error,
  47.             'title' => $title
  48.         ]);
  49.     }
  50.     /**
  51.      * @Route("/logout", name="system_logout")
  52.      */
  53.     public function logout()
  54.     {
  55.         return null;
  56.     }
  57. }