fix: auto redirect to login from homepage

pull/1004/head
Nick 5 years ago
parent 93237cdaeb
commit 13358b26b0

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

Loading…
Cancel
Save