fix: view page as unauthorized user

This commit is contained in:
Nicolas Giard 2019-05-02 01:11:34 -04:00 committed by GitHub
parent 8970e70333
commit 0d2aa56b79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -136,11 +136,9 @@ router.get('/*', async (req, res, next) => {
const pageArgs = pageHelper.parsePath(req.path) const pageArgs = pageHelper.parsePath(req.path)
if (!WIKI.auth.checkAccess(req.user, ['read:pages'], pageArgs)) { if (!WIKI.auth.checkAccess(req.user, ['read:pages'], pageArgs)) {
if (pageArgs.path === 'home') {
_.set(res.locals, 'pageMeta.title', 'Unauthorized') _.set(res.locals, 'pageMeta.title', 'Unauthorized')
return res.render('unauthorized', { action: 'view' }) return res.render('unauthorized', { action: 'view' })
} }
}
const page = await WIKI.models.pages.getPage({ const page = await WIKI.models.pages.getPage({
path: pageArgs.path, path: pageArgs.path,