mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-05 19:20:12 +08:00
fix: CSRF issue #51
This commit is contained in:
1 parent
91a9397c58
commit
2ac73a06c9
3 files changed
+11
No files matched your search
@@ -0,0 +1,11 @@
|
||||
import csrf from 'csurf'
|
||||
const CSRF = csrf({ cookie: true })
|
||||
function csrfProtection(req, res, next) {
|
||||
if (req.method === 'POST') {
|
||||
CSRF(req, res, next)
|
||||
} else {
|
||||
next()
|
||||
}
|
||||
}
|
||||
|
||||
export default csrfProtection
|
||||
Reference in new issue
Block a user