[英]FOSUserBundle - BadCredentialsException
I use FOSUserBundle to provide user authorization and registration. 我使用FOSUserBundle提供用户授权和注册。 Everything works fine, but when I try to log in using a non-existing username, I get this error:
一切正常,但当我尝试使用不存在的用户名登录时,我收到此错误:
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')
I've tried finding a solution, but I didn't get any results. 我试过找到一个解决方案,但我没有得到任何结果。
From the Github changelog : 来自Github更改日志 :
[BC break] The FOSUserBundle:Security:login.html.twig template now receives an AuthenticationException in the error variable rather than an error message.
[BC break] FOSUserBundle:Security:login.html.twig模板现在在错误变量中收到AuthenticationException而不是错误消息。
To fix the issue, you need to update your custom login template login.html.twig
: 要解决此问题,您需要更新自定义登录模板
login.html.twig
:
From: 从:
{% if error %}
... {{ error|trans }} ...
{% endif %}
To: 至:
{% if error %}
... {{ error.messageKey|trans(error.messageData, 'security') }} ...
{% endif %}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.