diff --git a/src/boot/axios.js b/src/boot/axios.js
index f8f27278c..259adad50 100644
--- a/src/boot/axios.js
+++ b/src/boot/axios.js
@@ -58,6 +58,12 @@ const onResponseError = (error) => {
break;
}
+ if (response.data?.error?.code === 'REQUIRES_2FA') {
+ console.log(window.location.hash);
+ console.log(window.location.hash.slice(1));
+ return Router.push({ name: 'TwoFactor' });
+ }
+
if (session.isLoggedIn() && response.status === 401) {
session.destroy();
const hash = window.location.hash;
diff --git a/src/pages/Login/LoginMain.vue b/src/pages/Login/LoginMain.vue
index 747fe8b14..b17cd326d 100644
--- a/src/pages/Login/LoginMain.vue
+++ b/src/pages/Login/LoginMain.vue
@@ -70,7 +70,7 @@ async function onSubmit() {
router.push({ name: 'Dashboard' });
}
} catch (e) {
- //
+ console.log('LOGIN ERROR', e);
}
}
diff --git a/src/pages/Login/TwoFactor.vue b/src/pages/Login/TwoFactor.vue
new file mode 100644
index 000000000..9241e0f22
--- /dev/null
+++ b/src/pages/Login/TwoFactor.vue
@@ -0,0 +1,187 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ t('globals.lang.en') }}
+
+
+ {{ t('globals.lang.es') }}
+
+
+
+
+
+
+
+
+ {{ t(`globals.darkMode`) }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/router/index.js b/src/router/index.js
index 9bc199047..cccf9af6d 100644
--- a/src/router/index.js
+++ b/src/router/index.js
@@ -45,8 +45,8 @@ export { Router };
export default route(function (/* { store, ssrContext } */) {
Router.beforeEach(async (to, from, next) => {
const { isLoggedIn } = session;
-
- if (!isLoggedIn() && to.name !== 'Login') {
+ const outLayout = ['Login', 'TwoFactor'];
+ if (!isLoggedIn() && !outLayout.includes(to.name)) {
return next({ name: 'Login', query: { redirect: to.fullPath } });
}
diff --git a/src/router/routes.js b/src/router/routes.js
index 17a56505d..04e188acb 100644
--- a/src/router/routes.js
+++ b/src/router/routes.js
@@ -12,6 +12,12 @@ const routes = [
meta: { title: 'logIn' },
component: () => import('../pages/Login/LoginMain.vue'),
},
+ {
+ path: '/twoFactor',
+ name: 'TwoFactor',
+ meta: { title: 'twoFactor' },
+ component: () => import('../pages/Login/TwoFactor.vue'),
+ },
{
path: '/',
name: 'Main',
@@ -35,7 +41,7 @@ const routes = [
name: 'NotFound',
component: () => import('../pages/NotFound.vue'),
},
- wagon
+ wagon,
],
},
];