From eb63a5d6ba842590fc0d537d91b530feae5da501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Mon, 23 Oct 2017 22:01:19 +0200 Subject: [PATCH 1/3] Added CSRF form-example in documentation (issue: #299) --- README.md | 14 ++++++++++++++ src/Pecee/Http/Middleware/BaseCsrfVerifier.php | 1 + 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index edfab1d..509c799 100644 --- a/README.md +++ b/README.md @@ -709,6 +709,20 @@ You can get the CSRF-token by calling the helper method: csrf_token(); ``` +The default name/key for the input-field is `csrf_token` and is defined in the `POST_KEY` constant in the `BaseCsrfVerifier` class. +You can change the key by overwriting the constant in your own CSRF-verifier class. + +**Example:** + +The example below will post to the current url and add a hidden field with the name of `csrf_token`. + +```php +
+ + +
+``` + --- # Middlewares diff --git a/src/Pecee/Http/Middleware/BaseCsrfVerifier.php b/src/Pecee/Http/Middleware/BaseCsrfVerifier.php index 5d2b4cf..6791029 100644 --- a/src/Pecee/Http/Middleware/BaseCsrfVerifier.php +++ b/src/Pecee/Http/Middleware/BaseCsrfVerifier.php @@ -1,4 +1,5 @@ Date: Mon, 23 Oct 2017 22:04:28 +0200 Subject: [PATCH 2/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 509c799..f8471ca 100644 --- a/README.md +++ b/README.md @@ -714,7 +714,7 @@ You can change the key by overwriting the constant in your own CSRF-verifier cla **Example:** -The example below will post to the current url and add a hidden field with the name of `csrf_token`. +The example below will post to the current url with a hidden field "`csrf_token`". ```php
From cc5e417db9779b357effd6ae770e0e9f0df7b5a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Mon, 23 Oct 2017 22:05:27 +0200 Subject: [PATCH 3/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f8471ca..7817f6a 100644 --- a/README.md +++ b/README.md @@ -716,7 +716,7 @@ You can change the key by overwriting the constant in your own CSRF-verifier cla The example below will post to the current url with a hidden field "`csrf_token`". -```php +```html