Skip to content

Commit abb2003

Browse files
committed
[Form] Document the hash_mapping option
1 parent c5ef631 commit abb2003

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

reference/forms/types/password.rst

+24
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,28 @@ 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_mapping``
39+
~~~~~~~~~~~~~~~~
40+
41+
**type**: ``string`` **default**: ``null``
42+
43+
If set, the password will be hashed using the PasswordHasher component and
44+
stored in the specified property.
45+
46+
Data passed to the form must be a ``PasswordAuthenticatedUserInterface`` object.
47+
48+
.. caution::
49+
50+
To minimize the risk of leaking the plain password,
51+
this option can only be used with the ``mapped`` option set to ``false``.
52+
53+
$builder->add('plainPassword', PasswordType::class, [
54+
'hash_mapping' => 'password',
55+
'mapped' => false,
56+
]);
57+
58+
See the :ref:`"mapped" option documentation <reference-form-mapped>`.
59+
3860
Overridden Options
3961
------------------
4062

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

82104
.. include:: /reference/forms/types/options/label_format.rst.inc
83105

106+
.. _reference-form-mapped:
107+
84108
.. include:: /reference/forms/types/options/mapped.rst.inc
85109

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

0 commit comments

Comments
 (0)