From 3ccfac9422ee2ae061cd4f4d12bce489c6aa89fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Thu, 22 Oct 2015 09:57:31 +0200 Subject: [PATCH 1/2] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3c8421e..d0287d1 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ Add the latest version pf Simple PHP Router to your ```composer.json``` - Global Constraints - Sub-Domain Routing -- Optional/required parameters +- Required parameters ## Initialising the router @@ -269,4 +269,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. From 63dfbb24af3e7d4bea6d96f818fc0991d3cd6c6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20Sessing=C3=B8?= Date: Thu, 22 Oct 2015 19:33:20 +0200 Subject: [PATCH 2/2] [BUGFIX] Bugfix - Fixed csrf-token cookie not being set on some paths. - Changed RouterException in BaseCsrfVerifier to TokenMismatchException. --- src/Pecee/Exception/TokenMismatchException.php | 4 ++++ src/Pecee/Http/Middleware/BaseCsrfVerifier.php | 14 +++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 src/Pecee/Exception/TokenMismatchException.php diff --git a/src/Pecee/Exception/TokenMismatchException.php b/src/Pecee/Exception/TokenMismatchException.php new file mode 100644 index 0000000..0a45962 --- /dev/null +++ b/src/Pecee/Exception/TokenMismatchException.php @@ -0,0 +1,4 @@ +csrfToken = new CsrfToken(); + } /** * Check if the url matches the urls in the except property @@ -52,9 +57,8 @@ class BaseCsrfVerifier extends Middleware { $token = $request->getHeader(self::HEADER_KEY); } - $tokenValidator = new CsrfToken(); - if( !$tokenValidator->validate( $token ) ) { - throw new RouterException('Invalid csrf-token.'); + if( !$this->csrfToken->validate( $token ) ) { + throw new TokenMismatchException('Invalid csrf-token.'); } }