This commit is contained in:
Henrique Dias committed 2017-10-09 08:14:17 +01:00
1 parent 769bdad12a
commit 90c2de44c3
2 files changed
+11 -2349

No files matched your search

+11 -7
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,16 +130,17 @@ 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()
-2342
View File
File diff suppressed because it is too large. Load diff