Skip to content

Commit a4c8b08

Browse files
committed
draft reset password doc
1 parent 29c03b6 commit a4c8b08

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

security/reset_password.rst

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
How to add secure forgotten password functionality
2+
==================================================
3+
4+
Using `MakerBundle`_ & `Symfony Cast's Reset Password Bundle`_ you can create a
5+
secure out of the box solution to handle forgotten passwords.
6+
7+
.. caution::
8+
9+
Make sure you have created a ``User`` class with a getter method to retrieve
10+
the users unique email address. The :doc:`Security Guide </security>` will help you
11+
install security.
12+
13+
Bootstrap reset password functionality
14+
---------------------------------------------
15+
16+
.. code-block:: terminal
17+
18+
$ php composer require symfonycasts/reset-password-bundle
19+
.....
20+
$ php bin/console make:reset-password
21+
22+
23+
The reset password maker will then ask you a couple questions about your app and
24+
generate the required files. Afterword's you should see a list of the files generated.
25+
26+
.. code-block:: terminal
27+
28+
created: src/Controller/ResetPasswordController.php
29+
created: src/Entity/ResetPasswordRequest.php
30+
created: src/Repository/ResetPasswordRequestRepository.php
31+
updated: config/packages/reset_password.yaml
32+
created: src/Form/ResetPasswordRequestFormType.php
33+
created: src/Form/ChangePasswordFormType.php
34+
created: templates/reset_password/check_email.html.twig
35+
created: templates/reset_password/email.html.twig
36+
created: templates/reset_password/request.html.twig
37+
created: templates/reset_password/reset.html.twig
38+
39+
40+
Success!
41+
42+
43+
Next:
44+
1) Run "php bin/console make:migration" to generate a migration for the new "App\Entity\ResetPasswordRequest" entity.
45+
2) Review forms in "src/Form" to customize validation and labels.
46+
3) Review and customize the templates in `templates/reset_password`.
47+
4) Make sure your MAILER_DSN env var has the correct settings.
48+
49+
Then open your browser, go to "/reset-password" and enjoy!
50+
51+
You can customize the reset password bundle's behavior by editing ``reset_password.yaml``.
52+
For more information on the configuration, check out the
53+
`Symfony Cast's Reset Password Bundle`_ guide.
54+
55+
.. _`MakerBundle`: https://symfony.com/doc/current/bundles/SymfonyMakerBundle/index.html
56+
.. _`Symfony Cast's Reset Password Bundle`: https://github.com/symfonycasts/reset-password-bundle

0 commit comments

Comments
 (0)