Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save yamadapc/4821e3ab96615ec4adda6e431ea93411 to your computer and use it in GitHub Desktop.
Save yamadapc/4821e3ab96615ec4adda6e431ea93411 to your computer and use it in GitHub Desktop.
From 99b6cd70563cd484cae2807c3e325ab65ca2338e Mon Sep 17 00:00:00 2001
From: yamadapc <tacla.yamada@gmail.com>
Date: Wed, 27 Jul 2016 18:33:14 -0300
Subject: [PATCH] Patch yesod templates to include CSRF middleware
---
yesod-mongo.hsfiles | 2 +-
yesod-mysql.hsfiles | 2 +-
yesod-postgres-fay.hsfiles | 2 +-
yesod-postgres.hsfiles | 2 +-
yesod-simple.hsfiles | 2 +-
yesod-sqlite.hsfiles | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/yesod-mongo.hsfiles b/yesod-mongo.hsfiles
index c999fcd..a6b8d8d 100644
--- a/yesod-mongo.hsfiles
+++ b/yesod-mongo.hsfiles
@@ -274,7 +274,7 @@ instance Yesod App where
-- a) Sets a cookie with a CSRF token in it.
-- b) Validates that incoming write requests include that token in either a header or POST parameter.
-- For details, see the CSRF documentation in the Yesod.Core.Handler module of the yesod-core package.
- yesodMiddleware = defaultYesodMiddleware
+ yesodMiddleware = defaultYesodMiddleware . defaultCsrfMiddleware
defaultLayout widget = do
master <- getYesod
diff --git a/yesod-mysql.hsfiles b/yesod-mysql.hsfiles
index 4d175fe..a0dddb9 100644
--- a/yesod-mysql.hsfiles
+++ b/yesod-mysql.hsfiles
@@ -292,7 +292,7 @@ instance Yesod App where
-- a) Sets a cookie with a CSRF token in it.
-- b) Validates that incoming write requests include that token in either a header or POST parameter.
-- For details, see the CSRF documentation in the Yesod.Core.Handler module of the yesod-core package.
- yesodMiddleware = defaultYesodMiddleware
+ yesodMiddleware = defaultYesodMiddleware . defaultCsrfMiddleware
defaultLayout widget = do
master <- getYesod
diff --git a/yesod-postgres-fay.hsfiles b/yesod-postgres-fay.hsfiles
index eaefa94..2f72bef 100644
--- a/yesod-postgres-fay.hsfiles
+++ b/yesod-postgres-fay.hsfiles
@@ -297,7 +297,7 @@ instance Yesod App where
-- a) Sets a cookie with a CSRF token in it.
-- b) Validates that incoming write requests include that token in either a header or POST parameter.
-- For details, see the CSRF documentation in the Yesod.Core.Handler module of the yesod-core package.
- yesodMiddleware = defaultYesodMiddleware
+ yesodMiddleware = defaultYesodMiddleware . defaultCsrfMiddleware
defaultLayout widget = do
master <- getYesod
diff --git a/yesod-postgres.hsfiles b/yesod-postgres.hsfiles
index e8fbb20..cd13b88 100644
--- a/yesod-postgres.hsfiles
+++ b/yesod-postgres.hsfiles
@@ -292,7 +292,7 @@ instance Yesod App where
-- a) Sets a cookie with a CSRF token in it.
-- b) Validates that incoming write requests include that token in either a header or POST parameter.
-- For details, see the CSRF documentation in the Yesod.Core.Handler module of the yesod-core package.
- yesodMiddleware = defaultYesodMiddleware
+ yesodMiddleware = defaultYesodMiddleware . defaultCsrfMiddleware
defaultLayout widget = do
master <- getYesod
diff --git a/yesod-simple.hsfiles b/yesod-simple.hsfiles
index c0f1122..e716d04 100644
--- a/yesod-simple.hsfiles
+++ b/yesod-simple.hsfiles
@@ -262,7 +262,7 @@ instance Yesod App where
-- a) Sets a cookie with a CSRF token in it.
-- b) Validates that incoming write requests include that token in either a header or POST parameter.
-- For details, see the CSRF documentation in the Yesod.Core.Handler module of the yesod-core package.
- yesodMiddleware = defaultYesodMiddleware
+ yesodMiddleware = defaultYesodMiddleware . defaultCsrfMiddleware
defaultLayout widget = do
master <- getYesod
diff --git a/yesod-sqlite.hsfiles b/yesod-sqlite.hsfiles
index 2a5c7c9..757dcc8 100644
--- a/yesod-sqlite.hsfiles
+++ b/yesod-sqlite.hsfiles
@@ -292,7 +292,7 @@ instance Yesod App where
-- a) Sets a cookie with a CSRF token in it.
-- b) Validates that incoming write requests include that token in either a header or POST parameter.
-- For details, see the CSRF documentation in the Yesod.Core.Handler module of the yesod-core package.
- yesodMiddleware = defaultYesodMiddleware
+ yesodMiddleware = defaultYesodMiddleware . defaultCsrfMiddleware
defaultLayout widget = do
master <- getYesod
--
2.9.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment