Skip to content

Commit 96ffbf9

Browse files
committed
docs: add section to enable CSRF filter
1 parent 4995720 commit 96ffbf9

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

user_guide_src/source/tutorial/create_news_items.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,20 @@ you haven't written any information to the database yet. In this section,
66
you'll expand your news controller and model created earlier to include
77
this functionality.
88

9+
Enable CSRF Filter
10+
------------------
11+
12+
Before creating a form, let's enable the CSRF protection.
13+
14+
Open the **app/Config/Filters.php** file and update the ``$methods`` property like the following::
15+
16+
public $methods = [
17+
'post' => ['csrf'],
18+
];
19+
20+
It configures the CSRF filter to be enabled for all **POST** requests.
21+
You can read more about the CSRF protection in :doc:`Security </libraries/security>` library.
22+
923
Create a form
1024
-------------
1125

0 commit comments

Comments
 (0)