How to customize in a Symfony2.1 app the error messages provided by the UserChecker class when using an User class that implements AdvancedUserInterface?
These messages are provided for instance when user is not enabled or its account has been locked!
You can do it even in Symfony 2.0 easily.
There is no need to reimplement the
UserCheckerInterface.Implement the login form as described here: Using a Traditional Login Form.
$erroris actually an instance of AuthenticationException.If you display it in the template like this:
… then you can customize the messages using the translation component, ex. in your messages.en.yml:
If you do that you get translations for free 🙂
BTW I’ve read a case study that suggested that specyfing to the user what exactly went wrong with the login (pass? username?) outweighs the security issues (in terms of UX) and greatly improves the conversion (returning users).