File tree 1 file changed +6
-3
lines changed 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -12,12 +12,11 @@ CSRF protection works by adding a hidden field to your form that contains a
12
12
value that only you and your user know. This ensures that the user - not some
13
13
other entity - is submitting the given data.
14
14
15
- Before using the CSRF protection, install it in your project (which in turn
16
- requires installing the Symfony Form component):
15
+ Before using the CSRF protection, install it in your project:
17
16
18
17
.. code-block :: terminal
19
18
20
- $ composer require security-csrf form
19
+ $ composer require security-csrf
21
20
22
21
Then, enable/disable the CSRF protection with the ``csrf_protection `` option
23
22
(see the :ref: `CSRF configuration reference <reference-framework-csrf-protection >`
@@ -278,6 +277,10 @@ After this, you have protected your login form against CSRF attacks.
278
277
CSRF Protection in HTML Forms
279
278
-----------------------------
280
279
280
+ .. versionadded :: 4.1
281
+ In Symfony versions prior to 4.1, CSRF support required installing the
282
+ Symfony Form component even if you didn't use it.
283
+
281
284
It's also possible to add CSRF protection to regular HTML forms not managed by
282
285
the Symfony Form component, for example the simple forms used to delete items.
283
286
First, use the ``csrf_token() `` function in the Twig template to generate a CSRF
You can’t perform that action at this time.
0 commit comments