diff --git a/admin/.env.dist b/admin/.env.dist
index a056837ab..6d78e6782 100644
--- a/admin/.env.dist
+++ b/admin/.env.dist
@@ -1,2 +1,3 @@
GRAPHQL_URI=http://localhost:4000/graphql
-WALLET_AUTH_URL=http://localhost/vue/authenticate?token=$1
\ No newline at end of file
+WALLET_AUTH_URL=http://localhost/vue/authenticate?token=$1
+DEBUG_DISABLE_AUTH=false
\ No newline at end of file
diff --git a/admin/src/App.vue b/admin/src/App.vue
index 40460eda4..7c3dd8514 100644
--- a/admin/src/App.vue
+++ b/admin/src/App.vue
@@ -1,15 +1,21 @@
-
+
diff --git a/admin/src/config/index.js b/admin/src/config/index.js
index 1ef44fe60..236274d1f 100644
--- a/admin/src/config/index.js
+++ b/admin/src/config/index.js
@@ -23,6 +23,10 @@ const endpoints = {
WALLET_AUTH_URL: process.env.WALLET_AUTH_URL || 'http://localhost:3000/vue/authenticate?token=$1'
}
+const debug = {
+ DEBUG_DISABLE_AUTH: process.env.DEBUG_DISABLE_AUTH === 'true' || false
+}
+
const options = {}
const CONFIG = {
@@ -30,6 +34,7 @@ const CONFIG = {
...environment,
...endpoints,
...options,
+ ...debug,
}
export default CONFIG
diff --git a/admin/src/router/guards.js b/admin/src/router/guards.js
index 6207f443e..a8bdaa2e2 100644
--- a/admin/src/router/guards.js
+++ b/admin/src/router/guards.js
@@ -1,5 +1,7 @@
+import CONFIG from "../config"
+
const addNavigationGuards = (router, store) => {
- // store token on authenticate
+ // store token on `authenticate`
router.beforeEach((to, from, next) => {
if (to.path === '/authenticate' && to.query.token) {
store.commit('token',to.query.token)
@@ -9,11 +11,13 @@ const addNavigationGuards = (router, store) => {
}
})
- // protect all routes but not-found
+ // protect all routes but `not-found`
router.beforeEach((to, from, next) => {
- console.log('protect', to.path, from.path)
- // handle authentication
- if (!store.state.token && to.path !== '/not-found' && to.path !== '/logout') {
+ if (!CONFIG.DEBUG_DISABLE_AUTH && // we did not disabled the auth module for debug purposes
+ !store.state.token && // we do not have a token
+ to.path !== '/not-found' && // we are not on `not-found`
+ to.path !== '/logout') { // we are not on `logout`
+ console.log(!CONFIG.DEBUG_DISABLE_AUTH,!store.state.token,to.path !== '/not-found',to.path !== '/logout')
next({ path: '/not-found' })
} else {
next()