I'm new to Symfony (working on my first project!) and I want to send the user back to the login page with an error saying "You aren't logged in" in case they aren't.
Is there any way to run something so that it changes the user's URL from /secured to /login and send data exactly like:
return $this->render('radloginBundle:Default:login.html.twig',array('errors'=>'You aren\'t logged in'));
So that in the login.html.twig, I have:
{% if errors is defined %}
<div class="red">{{errors}}</div>
{% endif %}
And it will show the user the error message?
I've heard of a method where you can do this:
return $this->redirect($this->generateUrl('radlogin_login',array('errors'=>'You aren\'t logged in')));
But the user's url turns into:
http://.../app_dev.php/login?errors=You+aren't+logged+in
instead of:
http://.../app_dev.php/login