Php FOSUserBundle-BadCredentialsException

Php FOSUserBundle-BadCredentialsException,php,symfony,fosuserbundle,Php,Symfony,Fosuserbundle,我使用FOSUserBundle提供用户授权和注册。一切正常,但当我尝试使用不存在的用户名登录时,出现以下错误: exception 'Symfony\Component\Security\Core\Exception\BadCredentialsException' with message 'Bad credentials' in /var/www/OnTheWay/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Auth

我使用FOSUserBundle提供用户授权和注册。一切正常,但当我尝试使用不存在的用户名登录时,出现以下错误:

exception 'Symfony\Component\Security\Core\Exception\BadCredentialsException'
with message 'Bad credentials' in
/var/www/OnTheWay/vendor/symfony/symfony/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php:73
Stack trace:
#0 /var/www/OnTheWay/app/cache/dev/classes.php(120): session_start()
#1 /var/www/OnTheWay/app/cache/dev/classes.php(198): Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->start()
#2 /var/www/OnTheWay/app/cache/dev/classes.php(498): Symfony\Component\HttpFoundation\Session\Storage\NativeSessionStorage->getBag('attributes')
我试图找到解决方案,但没有得到任何结果。

来自:

[BC break]FOSUserBundle:Security:login.html.twig模板现在 接收错误变量中的AuthenticationException,而不是 错误消息

要解决此问题,您需要更新自定义登录模板
login.html.twig

发件人:

致:


非常感谢
{% if error %}
    ... {{ error|trans }} ...
{% endif %}
{% if error %}
    ... {{ error.messageKey|trans(error.messageData, 'security') }} ...
{% endif %}