Skip to content

[Security] WIP - make:security:form-login is now available in MakerBundle #17481

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion security.rst
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,33 @@ Most websites have a login form where users authenticate using an
identifier (e.g. email address or username) and a password. This
functionality is provided by the *form login authenticator*.

First, create a controller for the login form:
`MakerBundle` has a new ``make:security:form-login`` command that was introduced
in ``v1.x.x`` that will generate the controller, twig template, and configure
``security.yaml`` after answering a couple of questions:

.. code-block:: terminal

$ php bin/console make:security:form-login

Choose a name for the controller class (e.g. SecurityController) [SecurityController]:
> SecurityController

Do you want to generate a '/logout' URL? (yes/no) [yes]:
> y

created: src/Controller/SecurityController.php
created: templates/security/login.html.twig
updated: config/packages/security.yaml


Success!


Next: Review and adapt the login template: security/login.html.twig to suite your needs.

WooHoo! You're all set to start authenticating users.

If you prefer to do this manually, first, create a controller for the login form:

.. code-block:: terminal

Expand Down