diff --git a/assets/src/router/index.js b/assets/src/router/index.js index 01ec3256..cbc0e1e3 100644 --- a/assets/src/router/index.js +++ b/assets/src/router/index.js @@ -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() diff --git a/rice-box.go.REMOVED.git-id b/rice-box.go.REMOVED.git-id deleted file mode 100644 index 636c900d..00000000 --- a/rice-box.go.REMOVED.git-id +++ /dev/null @@ -1 +0,0 @@ -fb04f17b945f280665365cf87b85c4f8c936b31a \ No newline at end of file