From ce210c94c6c02501f03d4dc3a601c719f2caf4a7 Mon Sep 17 00:00:00 2001 From: Jack Date: Sat, 14 Oct 2017 17:55:57 -0400 Subject: [PATCH] Proper auth requirements to some pages --- app/routes.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/routes.js b/app/routes.js index 868f562..9a443e9 100644 --- a/app/routes.js +++ b/app/routes.js @@ -29,7 +29,7 @@ var jwtauth = jwt({ module.exports = function(app) { app.use('/', index); - app.use('/home', home); + app.use('/home', jwtauth, home); app.use('/v', view); app.use('/api/upload', jwtauth, upload); app.use('/api/auth', auth); @@ -41,6 +41,7 @@ module.exports = function(app) { app.use(function(err, req, res, next) { if (err.name === 'UnauthorizedError') { res.status(401); + res.redirect('/login'); res.json({"message": err.name + ": " + err.message}); } })