I am using FOSUserBundle with Symfony 3.4 to login my users. When they enter a wrong password the following message is displayed:
I would like to add a check for the user type and add a custom error message such as: "You must be a Customer in order to login.".
I implemented a user checker in order to accomplish this task but it's not working as expected:
class CustomerUserChecker implements UserCheckerInterface
{
public function checkPreAuth(UserInterface $user)
{
// nothing to do here
return;
}
public function checkPostAuth(UserInterface $user)
{
if (!$user instanceof CustomerUser) {
throw new AuthenticationException('You must be a customer in order to login');
}
return;
}
}
I am getting this error:
How can I add a new error with my text?


