Skip to content

Commit a84226c

Browse files
committed
[#4732] Tweaking language, clarifying purpose of disabling form and that you can disable CSRF on 1 form
1 parent 24c4f42 commit a84226c

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

book/forms.rst

+2
Original file line numberDiff line numberDiff line change
@@ -1781,6 +1781,8 @@ The CSRF token can be customized on a form-by-form basis. For example::
17811781
// ...
17821782
}
17831783

1784+
.. _form-disable-csrf:
1785+
17841786
To disable CSRF protection, set the ``csrf_protection`` option to false.
17851787
Customizations can also be made globally in your project. For more information,
17861788
see the :ref:`form configuration reference <reference-framework-form>`

reference/configuration/framework.rst

+11-5
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,11 @@ enabled
218218

219219
Whether or not to enable support for the Form component.
220220

221-
You will also have to disable form support if you want to
222-
:ref:`disable the validation support <validation-enabled>`.
221+
If you don't use forms, setting this to ``false`` may increase your application's
222+
performance because less services will be loaded into the container.
223+
224+
If this is activated, the :ref:`validation system <validation-enabled>`
225+
is also enabled automatically.
223226

224227
csrf_protection
225228
~~~~~~~~~~~~~~~
@@ -232,9 +235,12 @@ enabled
232235
**type**: ``boolean`` **default**: ``true`` if form support is enabled, ``false``
233236
otherwise
234237

235-
This option can be used to disable CSRF protection of forms. You need to
236-
disable CSRF protection to be able to disable session. For example, this
237-
is useful when you only use forms in an API-only website.
238+
This option can be used to disable CSRF protection on *all* forms. But you
239+
can also :ref:`disable CSRF protection on individual forms <form-disable-csrf>`.
240+
241+
If you're using forms, but want to avoid starting your session (e.g. using
242+
forms in an API-only website), ``csrf_protection`` will need to be set to
243+
``false``.
238244

239245
field_name
240246
..........

0 commit comments

Comments
 (0)