Skip to content

Commit d8d31e6

Browse files
committed
minor #21575 [Form] fix default CSRF token input name (xabbuh)
This PR was merged into the 6.4 branch. Discussion ---------- [Form] fix default CSRF token input name Commits ------- b760a01 fix default CSRF token input name
2 parents 822a366 + b760a01 commit d8d31e6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

security/csrf.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ to do anything to be protected against CSRF attacks.
112112

113113
.. _form-csrf-customization:
114114

115-
By default Symfony adds the CSRF token in a hidden field called ``_csrf_token``, but
115+
By default Symfony adds the CSRF token in a hidden field called ``_token``, but
116116
this can be customized (1) globally for all forms and (2) on a form-by-form basis.
117117
Globally, you can configure it under the ``framework.form`` option:
118118

@@ -180,7 +180,7 @@ method of each form::
180180
// enable/disable CSRF protection for this form
181181
'csrf_protection' => true,
182182
// the name of the hidden HTML field that stores the token
183-
'csrf_field_name' => '_token',
183+
'csrf_field_name' => 'custom_token_name',
184184
// an arbitrary string used to generate the value of the token
185185
// using a different string for each form improves its security
186186
'csrf_token_id' => 'task_item',

0 commit comments

Comments
 (0)