mirror of
https://github.com/Foltik/Shimapan
synced 2024-11-10 23:53:31 -05:00
Proper auth requirements to some pages
This commit is contained in:
parent
336f74bbc1
commit
ce210c94c6
@ -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});
|
||||
}
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user