<?php
/**
* This file is part of the Pimcore X Installation by
* ercas GmbH & CO. KG <https://www.ercasdieagentur.de>
*
* @license GPLv3
*/
namespace App\mvk\Auth\Controller;
use Pimcore\Controller\FrontendController;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
class AuthController extends FrontendController
{
/**
* @Route("/{_locale}/portal/login", name="mvk_login", defaults={ "_locale": "de" })
*/
public function login(Request $request, AuthenticationUtils $authenticationUtils): Response
{
/** get the login error if there is one */
$error = $authenticationUtils->getLastAuthenticationError();
/** last username entered by the user*/
$lastUsername = $authenticationUtils->getLastUsername();
if($error !== null) {
$this->addFlash(
'error_auth',
$error
);
}
return $this->redirect('/de/login');
//return $this->render('mvk/security/login/index.html.twig', ['last_username' => $lastUsername, 'error'=> $error ]);
}
/**
* @Route("/{_locale}/portal/logout", name="mvk_logout", defaults={ "_locale": "de" })
*/
public function logout(): void
{
//can be blank: it will never be called!
}
}