mirror of
				https://github.com/kevinveenbirkenbach/infinito.git
				synced 2025-10-31 09:19:08 +00:00 
			
		
		
		
	Optimized login messages
This commit is contained in:
		| @@ -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",[ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user