fix: auto redirect to login from homepage

This commit is contained in:
Nick 2019-08-26 23:06:58 -04:00
parent 93237cdaeb
commit 13358b26b0

View File

@ -181,6 +181,9 @@ router.get('/*', async (req, res, next) => {
req.i18n.changeLanguage(pageArgs.locale) req.i18n.changeLanguage(pageArgs.locale)
if (!WIKI.auth.checkAccess(req.user, ['read:pages'], pageArgs)) { if (!WIKI.auth.checkAccess(req.user, ['read:pages'], pageArgs)) {
if (pageArgs.path === 'home') {
return res.redirect('/login')
}
_.set(res.locals, 'pageMeta.title', 'Unauthorized') _.set(res.locals, 'pageMeta.title', 'Unauthorized')
return res.status(403).render('unauthorized', { action: 'view' }) return res.status(403).render('unauthorized', { action: 'view' })
} }