Implemented some messages

This commit is contained in:
Kevin Frantz 2018-09-06 22:41:15 +02:00
parent e84d43b3f1
commit 2597529f01

View File

@ -6,6 +6,9 @@ use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface;
use Symfony\Component\HttpFoundation\Request;
use App\Entity\User;
/**
*
@ -23,13 +26,13 @@ class SecurityController extends AbstractController
$error = $authenticationUtils->getLastAuthenticationError();
if ($error) {
$this->addFlash('danger', $error->getMessage());
#$this->addFlash('info', $translator->trans('Code:%code%',['%code%'=>$error->getMessageKey()]));
}else{
$lastUsername = $authenticationUtils->getLastUsername();
if($lastUsername){
$this->addFlash('success', $translator->trans('User %user% loged in.',['user'=>$lastUsername]));
$this->addFlash('success', $translator->trans('User %user% loged in.',['%user%'=>$lastUsername]));
}
}
$this->addFlash('info', $authenticationUtils->getLastUsername());
return $this->render("user/login.html.twig",[
'last_username'=>$authenticationUtils->getLastUsername(),
]);