gpt4 book ai didi

php - FOSUserBundle - BadCredentialsException

转载 作者:IT王子 更新时间:2023-10-28 23:44:29 24 4
gpt4 key购买 nike

我使用 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')

我已尝试寻找解决方案,但没有得到任何结果。

最佳答案

来自 Github changelog :

[BC break] The FOSUserBundle:Security:login.html.twig template now receives an AuthenticationException in the error variable rather than an error message.

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

发件人:

{% if error %}
... {{ error|trans }} ...
{% endif %}

收件人:

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

关于php - FOSUserBundle - BadCredentialsException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26341728/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com