src/mvk/Auth/Controller/AuthController.php line 23

Open in your IDE?
  1. <?php
  2. /**
  3.  * This file is part of the Pimcore X Installation by
  4.  * ercas GmbH & CO. KG <https://www.ercasdieagentur.de>
  5.  *
  6.  *  @license GPLv3
  7.  */
  8. namespace App\mvk\Auth\Controller;
  9. use Pimcore\Controller\FrontendController;
  10. use Symfony\Component\HttpFoundation\Request;
  11. use Symfony\Component\HttpFoundation\Response;
  12. use Symfony\Component\Routing\Annotation\Route;
  13. use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
  14. class AuthController extends FrontendController
  15. {
  16.     /**
  17.      * @Route("/{_locale}/portal/login", name="mvk_login", defaults={ "_locale": "de" })
  18.      */
  19.     public function login(Request $requestAuthenticationUtils $authenticationUtils): Response
  20.     {
  21.         /** get the login error if there is one */
  22.         $error $authenticationUtils->getLastAuthenticationError();
  23.         /** last username entered by the user*/
  24.         $lastUsername $authenticationUtils->getLastUsername();
  25.         if($error !== null) {
  26.             $this->addFlash(
  27.                 'error_auth',
  28.                 $error
  29.             );
  30.         }
  31.         
  32.         return $this->redirect('/de/login');
  33.         //return $this->render('mvk/security/login/index.html.twig', ['last_username' => $lastUsername, 'error'=> $error ]);
  34.     }
  35.     /**
  36.      * @Route("/{_locale}/portal/logout", name="mvk_logout", defaults={ "_locale": "de" })
  37.      */
  38.     public function logout(): void
  39.     {
  40.         //can be blank: it will never be called!
  41.     }
  42. }