Convert Symfony Auth Scaffolding Login to use Form Builder

If you follow various tutorials (like this one) to set up some basic user authentication steps like a login form, logout route, user registration form… you’ll use commands like php bin/console make:registration and php bin/console make:registration which will generate login and registration forms for you. When I did this in Symfony 6, I ended up with a registration form created with Symfony’s Form Builder method and a login form created with a typical html form in the twig templates. Later when adding the symfonycasts/reset-password-bundle flow to add a ‘forgot my password’ step, this created another form using Form Builder. Eventually I ended up with all of my auth steps using Form Builder except the login form. Inconsistency- yuck!

I’m using Symfony 6.2 as of this writing.

Here’s how to switch the login form so it works like the rest.

Continue reading “Convert Symfony Auth Scaffolding Login to use Form Builder”