-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Fix some typos in helpers/form_helper.rst #8915
Conversation
for POST/PUT/DELETE/PATCH requests, but even for GET requests, CSRF filters must be enabled for pages that display Forms. | ||
|
||
If you enable CSRF filter with [$globals] https://codeigniter4.github.io/CodeIgniter4/incoming/filters.html#globals), it will be active for all request types. | ||
But if you enable CSRF filter with public array $methods = ['POST' => ['csrf']];, the hidden CSRF field will not be added in GET requests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kenjis I hope it is fixed now. I don't know how to preview before commit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please apply this patch:
--- a/user_guide_src/source/helpers/form_helper.rst
+++ b/user_guide_src/source/helpers/form_helper.rst
@@ -112,12 +112,17 @@ The following functions are available:
<form action="http://example.com/index.php/u/sign-up" method="post" accept-charset="utf-8">
<input type="hidden" id="my-id" name="csrf_test_name" value="964ede6e0ae8a680f7b8eab69136717d">
- .. note:: To use auto-generation of CSRF field, you need to turn on the :ref:`CSRF filter <enable-csrf-protection>` in **app/Config/Filters.php** file.
- In most cases the form page is requested using the GET method. Normally, CSRF protection is required
- for POST/PUT/DELETE/PATCH requests, but even for GET requests, CSRF filters must be enabled for pages that display Forms.
-
- If you enable CSRF filter with `$globals <https://codeigniter4.github.io/CodeIgniter4/incoming/filters.html#globals>`, it will be active for all request types.
- But if you enable CSRF filter with public array $methods = ['POST' => ['csrf']];, the hidden CSRF field will not be added in GET requests.
+ .. note:: To use auto-generation of CSRF field, you need to turn on the
+ :ref:`CSRF filter <enable-csrf-protection>` in **app/Config/Filters.php**
+ file. In most cases the form page is requested using the GET method.
+ Normally, CSRF protection is required for POST/PUT/DELETE/PATCH requests,
+ but even for GET requests, CSRF filters must be enabled for pages
+ that display Forms.
+
+ If you enable CSRF filter with :ref:`filters-globals`, it will be
+ active for all request types. But if you enable CSRF filter with
+ ``public array $methods = ['POST' => ['csrf']];``, the hidden CSRF
+ field will not be added in GET requests.
**Adding Hidden Input Fields**
diff --git a/user_guide_src/source/incoming/filters.rst b/user_guide_src/source/incoming/filters.rst
index 303f80b551..4425ce03d3 100644
--- a/user_guide_src/source/incoming/filters.rst
+++ b/user_guide_src/source/incoming/filters.rst
@@ -139,6 +139,8 @@ Filters can be specified by adding their alias to either the ``before`` or ``aft
.. literalinclude:: filters/013.php
+.. _filters-globals:
+
$globals
--------
Thank you for updating. |
@kenjis I had problems having my branches in local computer. That is why, when I want to fix something in the guide while reading it on the internet, there is a button "Edit this page", I just click it, edit the file, and commit. This way it creates a new branch each time. After sending form_helper (pacth-9) PR, there was a link on top to update the branch and I clicked. That was wrong as I understand now. But unfortunately I don't know how to roll it back on github. (I work completely on github. No local files or folders on my computer.) So can you please lead me how to do? Or I can delete this patch and close the PR and recreate it. |
@obozdag |
@kenjis I followed the documentation. I ran following commands:
But the PR is automatically closed. So it means I couldn't remove the merge commit in the last? |
It seems the Your commands seem no problem. I'm not sure why both branches are the same. |
@kenjis Run those commands. But no difference I think. So I will redo changes from scratch and small changes for each PR this time. Thanks for your effort. |
Your https://github.com/obozdag/CodeIgniter4/tree/develop is now up to date with codeigniter4/CodeIgniter4:develop. |
I uploaded my local |
Description
docs: Fix some typos in helpers/form_helper.rst
Checklist: