mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-07 19:10:12 +08:00
csrf token
This commit is contained in:
1 parent
d45fbee647
commit
42278ad51b
8 files changed
+44
-82
No files matched your search
@@ -1,12 +0,0 @@
|
||||
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