pull/254/head
Henrique Dias 2017-10-09 08:14:17 +01:00
parent 769bdad12a
commit 90c2de44c3
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
2 changed files with 11 additions and 2349 deletions

View File

@ -54,6 +54,9 @@ const router = new Router({
redirect: { redirect: {
path: '/settings/profile' path: '/settings/profile'
}, },
meta: {
disableOnNoAuth: true
},
children: [ children: [
{ {
path: '/settings/profile', path: '/settings/profile',
@ -127,17 +130,18 @@ router.beforeEach((to, from, next) => {
auth.loggedIn() auth.loggedIn()
.then(() => { .then(() => {
if (to.matched.some(record => record.meta.requiresAdmin)) { if (to.matched.some(record => record.meta.requiresAdmin)) {
if (store.state.user.admin) { if (!store.state.user.admin) {
next() next({ path: '/403' })
return return
} }
}
next({ if (to.matched.some(record => record.meta.disableOnNoAuth)) {
path: '/403' if (store.state.noAuth) {
}) next({ path: '/403' })
return return
} }
}
next() next()
}) })

File diff suppressed because one or more lines are too long