Comparing version 1.5.0 to 1.6.0
@@ -0,1 +1,6 @@ | ||
1.6.0 / 2014-09-03 | ||
================== | ||
* set `code` property on CSRF token errors | ||
1.5.0 / 2014-08-24 | ||
@@ -2,0 +7,0 @@ ================== |
@@ -236,3 +236,4 @@ /*! | ||
err.status = 403 | ||
err.code = 'EBADCSRFTOKEN' | ||
throw err | ||
} |
{ | ||
"name": "csurf", | ||
"description": "CSRF token middleware", | ||
"version": "1.5.0", | ||
"version": "1.6.0", | ||
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)", | ||
@@ -17,3 +17,3 @@ "contributors": [ | ||
"devDependencies": { | ||
"body-parser": "~1.5.2", | ||
"body-parser": "~1.7.0", | ||
"connect": "3", | ||
@@ -20,0 +20,0 @@ "cookie-parser": "~1.3.1", |
@@ -56,2 +56,11 @@ # csurf | ||
app.use(csrf()) | ||
// error handler | ||
app.use(function (err, req, res, next) { | ||
if (err.code !== 'EBADCSRFTOKEN') return next(err) | ||
// handle CSRF token errors here | ||
res.status(403) | ||
res.send('session has expired or form tampered with') | ||
}) | ||
``` | ||
@@ -69,3 +78,3 @@ | ||
[coveralls-url]: https://coveralls.io/r/expressjs/csurf?branch=master | ||
[downloads-image]: http://img.shields.io/npm/dm/csurf.svg?style=flat | ||
[downloads-image]: https://img.shields.io/npm/dm/csurf.svg?style=flat | ||
[downloads-url]: https://npmjs.org/package/csurf |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10697
195
79