Symfony 2 authentication

The Symfony 2 documentation shows how to create an entity-based form and validate it in the controller upon submission to ensure that certain fields have been filled out on the server side.

However, looking at the documentation for authentication, it uses a completely different approach for creating and processing the form, where you simply define the route for check_login without declaring the controller, since it is taken for a security suite.

Since login / authentication verification is now associated with a security suite, you have no way to implement any verification in the controller, as the form verification documentation shows.

Without the required HTML5 tag, you can spam the login form with empty entries.

How to add form confirmation for email and password fields based on Symfony authentication documentation here: http://symfony.com/doc/current/book/security.html#book-security-encoding-user-password

Also the error when sending the wrong credentials simply says "Invalid credentials", how do I configure this error?

thanks

+4
source share
1 answer

There are sections of the Symfony2 documentation that accurately reflect your problem. One of them concerns the actual login form , and the other - how you can configure it .

Validation is performed entirely on the Symfony2 site. You have nothing to worry about. You just need to create a controller to display the login form and possible errors. In addition, an entity provider can be used to use dynamically created users (stored in a database).

Finally, you can customize the error message using translation .

0
source

All Articles