mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 06:01:35 +01:00
Optimized login messages
This commit is contained in:
parent
cff5afe018
commit
0ead23e063
@ -5,6 +5,7 @@ use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
||||
use Symfony\Component\Translation\TranslatorInterface;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -17,13 +18,16 @@ class SecurityController extends AbstractController
|
||||
*
|
||||
* @Route("/login", name="login")
|
||||
*/
|
||||
public function login(AuthenticationUtils $authenticationUtils): Response
|
||||
public function login(AuthenticationUtils $authenticationUtils,TranslatorInterface $translator): Response
|
||||
{
|
||||
$error = $authenticationUtils->getLastAuthenticationError();
|
||||
if ($error) {
|
||||
$this->addFlash('danger', $error->getMessage());
|
||||
}else{
|
||||
$this->addFlash('success', "User loged in.");
|
||||
$lastUsername = $authenticationUtils->getLastUsername();
|
||||
if($lastUsername){
|
||||
$this->addFlash('success', $translator->trans('User %user% loged in.',['user'=>$lastUsername]));
|
||||
}
|
||||
}
|
||||
$this->addFlash('info', $authenticationUtils->getLastUsername());
|
||||
return $this->render("user/login.html.twig",[
|
||||
|
Loading…
Reference in New Issue
Block a user