Skip to content

Avoiding the term "login form"... #17137

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 1 commit into from
Jan 18, 2024
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
20 changes: 9 additions & 11 deletions security/login_link.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,8 @@ my password, etc.)
Using the Login Link Authenticator
----------------------------------

This guide assumes you have setup security and have created a user object
in your application. Follow :doc:`the main security guide </security>` if
this is not yet the case.
This guide assumes you have :doc:`setup security and have created a user object </security>`
in your application.

1) Configure the Login Link Authenticator
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -164,9 +163,8 @@ intercept requests to this route:
2) Generate the Login Link
~~~~~~~~~~~~~~~~~~~~~~~~~~

Now that the authenticator is able to check the login links, you must
create a page where a user can request a login link and log in to your
website.
Now that the authenticator is able to check the login links, you can
create a page where a user can request a login link.

The login link can be generated using the
:class:`Symfony\\Component\\Security\\Http\\LoginLink\\LoginLinkHandlerInterface`.
Expand All @@ -189,7 +187,7 @@ this interface::
*/
public function requestLoginLink(LoginLinkHandlerInterface $loginLinkHandler, UserRepository $userRepository, Request $request)
{
// check if login form is submitted
// check if form is submitted
if ($request->isMethod('POST')) {
// load the user in some way (e.g. using the form input)
$email = $request->request->get('email');
Expand All @@ -203,16 +201,16 @@ this interface::
// ... send the link and return a response (see next section)
}

// if it's not submitted, render the "login" form
return $this->render('security/login.html.twig');
// if it's not submitted, render the "request" form
return $this->render('security/request_login_link.html.twig');
}

// ...
}

.. code-block:: html+twig

{# templates/security/login.html.twig #}
{# templates/security/request_login_link.html.twig #}
{% extends 'base.html.twig' %}

{% block body %}
Expand Down Expand Up @@ -802,7 +800,7 @@ features such as the locale used to generate the link::
// ...
}

return $this->render('security/login.html.twig');
return $this->render('security/request_login_link.html.twig');
}

// ...
Expand Down