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: {
path: '/settings/profile'
},
meta: {
disableOnNoAuth: true
},
children: [
{
path: '/settings/profile',
@ -127,16 +130,17 @@ router.beforeEach((to, from, next) => {
auth.loggedIn()
.then(() => {
if (to.matched.some(record => record.meta.requiresAdmin)) {
if (store.state.user.admin) {
next()
if (!store.state.user.admin) {
next({ path: '/403' })
return
}
}
next({
path: '/403'
})
return
if (to.matched.some(record => record.meta.disableOnNoAuth)) {
if (store.state.noAuth) {
next({ path: '/403' })
return
}
}
next()

File diff suppressed because one or more lines are too long