diff options
author | 2020-11-22 13:49:09 +0100 | |
---|---|---|
committer | 2020-11-22 13:49:09 +0100 | |
commit | 4569b85489e863465395f84e995dd3fdc44471b4 (patch) | |
tree | 6e4d27883809c94c8b3f3b87159d85c7f3874bbd /app.js | |
parent | 81ddf9b700bc48a1f8e472209f080f9c1d9a9b09 (diff) | |
download | website_creator-4569b85489e863465395f84e995dd3fdc44471b4.tar.gz website_creator-4569b85489e863465395f84e995dd3fdc44471b4.tar.bz2 website_creator-4569b85489e863465395f84e995dd3fdc44471b4.zip |
implement refresh tokens
Diffstat (limited to 'app.js')
-rwxr-xr-x | app.js | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -16,7 +16,13 @@ app.use(cookieParser()); app.use('/api/user/', userRoutes); -app.use('/admin/', auth, express.static(path.join(__dirname, 'client/admin'))); +app.use('/admin/', auth, express.static(path.join(__dirname, 'client/admin'), { + setHeaders: function (res, path, stat) { + if (res.req.newToken){ + res.set('Set-Cookie', "token=" + res.req.newToken + ";httpOnly;MaxAge=604800000;Path=/"); + } + } +})); app.use('/login/', redirectIfLoggedIn, express.static(path.join(__dirname, 'client/login'))); |