I use FOSUserBundle to provide user authorization and registration. 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:
[BC break] The FOSUserBundle:Security:login.html.twig template now receives an AuthenticationException in the error variable rather than an error message.
To fix the issue, you need to update your custom login template login.html.twig
:
From:
{% if error %}
... {{ error|trans }} ...
{% endif %}
To:
{% if error %}
... {{ error.messageKey|trans(error.messageData, 'security') }} ...
{% endif %}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With