Skip to content

Commit 228d73e

Browse files
Seb33300wouterj
authored andcommitted
[Form] Document the hash_property_path option
1 parent 7d6d2f6 commit 228d73e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

reference/forms/types/password.rst

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,34 @@ with the ``value`` attribute set to its true value only upon submission.
3535
If you want to render your password field *with* the password value already
3636
entered into the box, set this to false and submit the form.
3737

38+
``hash_property_path``
39+
~~~~~~~~~~~~~~~~~~~~~~
40+
41+
**type**: ``string`` **default**: ``null``
42+
43+
.. versionadded:: 6.2
44+
45+
The ``hash_property_path`` option was introduced in Symfony 6.2.
46+
47+
If set, the password will be hashed using the
48+
:doc:`PasswordHasher component </security/passwords>` and stored in the
49+
specified property.
50+
51+
Data passed to the form must be a
52+
:class:`Symfony\\Component\\Security\\Core\\User\\PasswordAuthenticatedUserInterface`
53+
object.
54+
55+
.. caution::
56+
57+
To minimize the risk of leaking the plain password, this option can
58+
only be used with the :ref:`"mapped" option <reference-form-password-mapped>`
59+
set to ``false``::
60+
61+
$builder->add('plainPassword', PasswordType::class, [
62+
'hash_property_path' => 'password',
63+
'mapped' => false,
64+
]);
65+
3866
Overridden Options
3967
------------------
4068

@@ -81,6 +109,8 @@ The default value is ``''`` (the empty string).
81109

82110
.. include:: /reference/forms/types/options/label_format.rst.inc
83111

112+
.. _reference-form-password-mapped:
113+
84114
.. include:: /reference/forms/types/options/mapped.rst.inc
85115

86116
.. include:: /reference/forms/types/options/required.rst.inc

0 commit comments

Comments
 (0)