diff options
-rw-r--r-- | src/router/routes.js | 2 | ||||
-rw-r--r-- | src/store/modules/Authentication/AuthenticanStore.js | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/src/router/routes.js b/src/router/routes.js index eb376aad..5424cab8 100644 --- a/src/router/routes.js +++ b/src/router/routes.js @@ -301,4 +301,4 @@ const routes = [ }, ]; -export default routes; +export { routes as default, roles }; diff --git a/src/store/modules/Authentication/AuthenticanStore.js b/src/store/modules/Authentication/AuthenticanStore.js index 57270159..2006661b 100644 --- a/src/store/modules/Authentication/AuthenticanStore.js +++ b/src/store/modules/Authentication/AuthenticanStore.js @@ -1,6 +1,7 @@ import api from '@/store/api'; import Cookies from 'js-cookie'; import router from '@/router'; +import { roles } from '@/router/routes'; const AuthenticationStore = { namespaced: true, @@ -68,7 +69,16 @@ const AuthenticationStore = { commit('global/setPrivilege', data.RoleId, { root: true }); return data; }) - .catch((error) => console.log(error)); + .catch((error) => { + if (error.response?.status === 404) { + // We have valid credentials but user isn't known, assume remote + // authentication (e.g. LDAP) and do not restrict the routing + commit('global/setPrivilege', roles.administrator, { root: true }); + return {}; + } else { + console.log(error); + } + }); }, resetStoreState({ state }) { state.authError = false; |