1
0
mirror of https://github.com/Foltik/Shimapan synced 2024-09-21 11:11:22 -04:00

Proper auth requirements to some pages

This commit is contained in:
Jack 2017-10-14 17:55:57 -04:00
parent 336f74bbc1
commit ce210c94c6
Signed by: foltik
GPG Key ID: 303F88F996E95541

View File

@ -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});
}
})