title: Symfony2: Override exception messages in form login
body: <p>I've built a login form rendered by this controller action:</p>
  
  <pre><code>public function loginAction() {
      $helper = $this-&gt;get('security.authentication_utils');
      return $this-&gt;render('SecurityLoginBundle:Login:login.html.twig', array(
                  'last_username' =&gt; $helper-&gt;getLastUsername(),
                  'error' =&gt; $helper-&gt;getLastAuthenticationError(),
      ));
  }
  </code></pre>
  
  <p>If the user does not provide a valid email/password "getLastAuthenticationError()" throws a "BadCredentialsException"; if the user is disabled a "DisabledException" is thrown. Both exception objects have a "message" property but I'd like to change the labels. How do I do that? </p>
  
  <p>An ugly workaround would be to read those messages in my Twig template and replace them with my wording but is there a better way? Like checking the class of the "<em>error</em>" parameter in Twig. Unfortunately </p>
  
  <pre><code>get_class($helper-&gt;getLastAuthenticationError())
  </code></pre>
  
  <p>didn't work - it returns "<em>Security\LoginBundle\Controller\LoginController</em>".</p>
  
  <p>Thanks!</p>