Created
October 26, 2018 15:43
-
-
Save laniltee/ee0a6fca5a17422efe093e7b928d88f2 to your computer and use it in GitHub Desktop.
Log out js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Signs out and clear the session ID with CSRF token | |
app.post('/logout', (req, res) => { | |
const sessionID = req.cookies['session-id']; | |
delete SESSION_IDS[sessionID]; | |
console.log(sessionID + ': Removed'); | |
res.clearCookie("session-id"); | |
res.clearCookie("time"); | |
res.sendFile('views/login.html', {root: __dirname}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment