src/Controller/SecurityController.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Controller;
  3. use Symfony\Component\HttpFoundation\Response;
  4. use Symfony\Component\Routing\Annotation\Route;
  5. use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
  6. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  7. class SecurityController extends AbstractController
  8. {
  9.     /**
  10.      * @Route("/admin1807/login", name="login")
  11.      */
  12.     public function login(AuthenticationUtils $authenticationUtils): Response
  13.     {
  14.         $error $authenticationUtils->getLastAuthenticationError();
  15.         $lastUsername $authenticationUtils->getLastUsername();
  16.         return $this->render('@EasyAdmin/page/login.html.twig', [
  17.             // parameters usually defined in Symfony login forms
  18.             'error' => $error,
  19.             'last_username' => $lastUsername,
  20.             // OPTIONAL parameters to customize the login form:
  21.             // the translation_domain to use (define this option only if you are
  22.             // rendering the login template in a regular Symfony controller; when
  23.             // rendering it from an EasyAdmin Dashboard this is automatically set to
  24.             // the same domain as the rest of the Dashboard)
  25.             'translation_domain' => 'admin',
  26.             // the title visible above the login form (define this option only if you are
  27.             // rendering the login template in a regular Symfony controller; when rendering
  28.             // it from an EasyAdmin Dashboard this is automatically set as the Dashboard title)
  29.             'page_title' => '<img class="mt-5 mb-3" src="/images/about/logo-admin-dark-h.png">',
  30.             // the string used to generate the CSRF token. If you don't define
  31.             // this parameter, the login form won't include a CSRF token
  32.             'csrf_token_intention' => 'authenticate',
  33.             // the URL users are redirected to after the login (default: '/admin')
  34.             'target_path' => $this->generateUrl('admin_dashboard'),
  35.             // the label displayed for the username form field (the |trans filter is applied to it)
  36.             'username_label' => 'Email',
  37.             // the label displayed for the password form field (the |trans filter is applied to it)
  38.             'password_label' => 'Mot de passe',
  39.             // the label displayed for the Sign In form button (the |trans filter is applied to it)
  40.             'sign_in_label' => 'Connexion',
  41.             // the 'name' HTML attribute of the <input> used for the username field (default: '_username')
  42.             'username_parameter' => 'email',
  43.             // the 'name' HTML attribute of the <input> used for the password field (default: '_password')
  44.             'password_parameter' => 'password',
  45.             // whether to enable or not the "forgot password?" link (default: false)
  46.             'forgot_password_enabled' => true,
  47.             // the path (i.e. a relative or absolute URL) to visit when clicking the "forgot password?" link (default: '#')
  48.             'forgot_password_path' => $this->generateUrl('reset_password'),
  49.             // the label displayed for the "forgot password?" link (the |trans filter is applied to it)
  50.             'forgot_password_label' => 'Mot de passe oubliĆ© ?',
  51.             // whether to enable or not the "remember me" checkbox (default: false)
  52.             'remember_me_enabled' => true,
  53.             // remember me name form field (default: '_remember_me')
  54.             'remember_me_parameter' => '_remember_me',
  55.             // whether to check by default the "remember me" checkbox (default: false)
  56.             'remember_me_checked' => true,
  57.             // the label displayed for the remember me checkbox (the |trans filter is applied to it)
  58.             'remember_me_label' => 'Se souvenir de moi',
  59.         ]);
  60.     }
  61.     /**
  62.      * @Route("/logout", name="logout")
  63.      */
  64.     public function logout(): void
  65.     {
  66.         throw new \LogicException('This method can be blank - it will be intercepted by the logout key on your firewall.');
  67.     }
  68. }