Issue
I build empty new project on 5.4 version, i use those commands to build project:
composer create-project symfony/skeleton:"^5.4" testapp54 &&
cd testapp54 &&
composer require webapp &&
composer require symfony/apache-pack &&
composer require symfonycasts/verify-email-bundle &&
composer require symfony/security-bundle &&
composer require symfonycasts/reset-password-bundle &&
php bin/console make:controller MainController &&
php bin/console make:user &&
php bin/console make:auth &&
php bin/console make:registration &&
php bin/console make:reset-password &&
php bin/console make:migration &&
php bin/console doctrine:migrations:migrate
After those install and config app working fine, i can even register, if i choose in conf option
Do you want to automatically authenticate the user after registration? (yes/no) [yes]:
on yes, i am logged after register. But if i logout and try login again i can't ! I dont have any errors even i put wrong credensials.
Solution
Back around 5.2, Symfony introduced yet another authentication system known as Http authentication. It's goal was to replace the older Guard authentication system.
The Authenticator class contains a supports method which basically detects when POST /login is being processed and kicks off the authentication process. If the method return false then no attempt at authentication is made.
In the newly introduced Http authentication system, the default supports method is not very robust. It works when using the symfony server:run
webserver but fails for many other valid server configurations.
So if your authentication fails with no error messages then try overriding the supports method in your make:auth generated authenticator class with:
public function supports(Request $request)
{
return self::LOGIN_ROUTE === $request->attributes->get('_route')
&& $request->isMethod('POST');
}
And see if that helps. It's what the older Guard authenticator used to use. And feel free to comment on https://github.com/symfony/maker-bundle/issues/1056. Maybe we can get the maker folks to tweak their code.
Answered By - Cerad
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.