@adminforth/two-factors-auth 1.10.5 → 1.10.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build.log +2 -2
- package/custom/TwoFactorsConfirmation.vue +23 -10
- package/custom/TwoFactorsPasskeysSettings.vue +2 -2
- package/custom/TwoFactorsSetup.vue +11 -1
- package/dist/custom/TwoFactorsConfirmation.vue +23 -10
- package/dist/custom/TwoFactorsPasskeysSettings.vue +2 -2
- package/dist/custom/TwoFactorsSetup.vue +11 -1
- package/dist/index.js +4 -4
- package/index.ts +4 -4
- package/package.json +1 -1
package/build.log
CHANGED
|
@@ -12,5 +12,5 @@ custom/package-lock.json
|
|
|
12
12
|
custom/package.json
|
|
13
13
|
custom/tsconfig.json
|
|
14
14
|
|
|
15
|
-
sent
|
|
16
|
-
total size is 57,
|
|
15
|
+
sent 58,387 bytes received 153 bytes 117,080.00 bytes/sec
|
|
16
|
+
total size is 57,814 speedup is 0.99
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
|
|
75
75
|
<script setup lang="ts">
|
|
76
76
|
|
|
77
|
-
import { onMounted, nextTick, onBeforeUnmount, ref, watch } from 'vue';
|
|
77
|
+
import { onMounted, nextTick, onBeforeUnmount, ref, watch, onBeforeMount } from 'vue';
|
|
78
78
|
import { useCoreStore } from '@/stores/core';
|
|
79
79
|
import { useUserStore } from '@/stores/user';
|
|
80
80
|
import { callAdminForthApi, loadFile } from '@/utils';
|
|
@@ -95,6 +95,17 @@
|
|
|
95
95
|
const router = useRouter();
|
|
96
96
|
const codeError = ref(null);
|
|
97
97
|
|
|
98
|
+
onBeforeMount(() => {
|
|
99
|
+
if (localStorage.getItem('isAuthorized') === 'true') {
|
|
100
|
+
coreStore.fetchMenuAndResource();
|
|
101
|
+
if (route.query.next) {
|
|
102
|
+
router.push(route.query.next.toString());
|
|
103
|
+
} else {
|
|
104
|
+
router.push({ name: 'home' });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
|
|
98
109
|
const handleOnComplete = (value) => {
|
|
99
110
|
sendCode(value, 'TOTP', null);
|
|
100
111
|
};
|
|
@@ -121,16 +132,18 @@
|
|
|
121
132
|
const isPasskeysSupported = ref(false);
|
|
122
133
|
|
|
123
134
|
onMounted(async () => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
135
|
+
if (localStorage.getItem('isAuthorized') !== 'true') {
|
|
136
|
+
await nextTick();
|
|
137
|
+
await isCMAAvailable();
|
|
138
|
+
tagOtpInputs();
|
|
139
|
+
if (isPasskeysSupported.value === true) {
|
|
140
|
+
checkIfUserHasPasskeys();
|
|
141
|
+
}
|
|
142
|
+
document.addEventListener('focusin', handleGlobalFocusIn, true);
|
|
143
|
+
focusFirstAvailableOtpInput();
|
|
144
|
+
const rootEl = otpRoot.value;
|
|
145
|
+
rootEl && rootEl.addEventListener('focusout', handleFocusOut, true);
|
|
129
146
|
}
|
|
130
|
-
document.addEventListener('focusin', handleGlobalFocusIn, true);
|
|
131
|
-
focusFirstAvailableOtpInput();
|
|
132
|
-
const rootEl = otpRoot.value;
|
|
133
|
-
rootEl && rootEl.addEventListener('focusout', handleFocusOut, true);
|
|
134
147
|
});
|
|
135
148
|
|
|
136
149
|
watch(route, (newRoute) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="text-3xl text-gray-900 font-semibold
|
|
3
|
-
<p>Passkeys</p>
|
|
2
|
+
<div class="text-3xl text-gray-900 font-semibold max-w-2xl mr-6 flex-col justify-center items-center">
|
|
3
|
+
<p class="flex items-start justify-start leading-none">Passkeys</p>
|
|
4
4
|
<div class="flex flex-col items-end">
|
|
5
5
|
<Table
|
|
6
6
|
class="mt-4 w-full"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
|
|
68
68
|
<script setup lang="ts">
|
|
69
69
|
|
|
70
|
-
import { onMounted, onBeforeUnmount, nextTick, ref, watchEffect,computed,watch } from 'vue';
|
|
70
|
+
import { onMounted, onBeforeUnmount, nextTick, ref, watchEffect,computed,watch, onBeforeMount } from 'vue';
|
|
71
71
|
import { useCoreStore } from '@/stores/core';
|
|
72
72
|
import { useUserStore } from '@/stores/user';
|
|
73
73
|
import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbite';
|
|
@@ -86,6 +86,16 @@ import ErrorMessage from '@/components/ErrorMessage.vue';
|
|
|
86
86
|
const { t } = useI18n();
|
|
87
87
|
const route = useRoute()
|
|
88
88
|
|
|
89
|
+
onBeforeMount(() => {
|
|
90
|
+
if (localStorage.getItem('isAuthorized') === 'true') {
|
|
91
|
+
coreStore.fetchMenuAndResource();
|
|
92
|
+
if (route.query.next) {
|
|
93
|
+
router.push(route.query.next.toString());
|
|
94
|
+
} else {
|
|
95
|
+
router.push({ name: 'home' });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
})
|
|
89
99
|
|
|
90
100
|
const code = ref(null);
|
|
91
101
|
const codeError = ref(null);
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
|
|
75
75
|
<script setup lang="ts">
|
|
76
76
|
|
|
77
|
-
import { onMounted, nextTick, onBeforeUnmount, ref, watch } from 'vue';
|
|
77
|
+
import { onMounted, nextTick, onBeforeUnmount, ref, watch, onBeforeMount } from 'vue';
|
|
78
78
|
import { useCoreStore } from '@/stores/core';
|
|
79
79
|
import { useUserStore } from '@/stores/user';
|
|
80
80
|
import { callAdminForthApi, loadFile } from '@/utils';
|
|
@@ -95,6 +95,17 @@
|
|
|
95
95
|
const router = useRouter();
|
|
96
96
|
const codeError = ref(null);
|
|
97
97
|
|
|
98
|
+
onBeforeMount(() => {
|
|
99
|
+
if (localStorage.getItem('isAuthorized') === 'true') {
|
|
100
|
+
coreStore.fetchMenuAndResource();
|
|
101
|
+
if (route.query.next) {
|
|
102
|
+
router.push(route.query.next.toString());
|
|
103
|
+
} else {
|
|
104
|
+
router.push({ name: 'home' });
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
})
|
|
108
|
+
|
|
98
109
|
const handleOnComplete = (value) => {
|
|
99
110
|
sendCode(value, 'TOTP', null);
|
|
100
111
|
};
|
|
@@ -121,16 +132,18 @@
|
|
|
121
132
|
const isPasskeysSupported = ref(false);
|
|
122
133
|
|
|
123
134
|
onMounted(async () => {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
135
|
+
if (localStorage.getItem('isAuthorized') !== 'true') {
|
|
136
|
+
await nextTick();
|
|
137
|
+
await isCMAAvailable();
|
|
138
|
+
tagOtpInputs();
|
|
139
|
+
if (isPasskeysSupported.value === true) {
|
|
140
|
+
checkIfUserHasPasskeys();
|
|
141
|
+
}
|
|
142
|
+
document.addEventListener('focusin', handleGlobalFocusIn, true);
|
|
143
|
+
focusFirstAvailableOtpInput();
|
|
144
|
+
const rootEl = otpRoot.value;
|
|
145
|
+
rootEl && rootEl.addEventListener('focusout', handleFocusOut, true);
|
|
129
146
|
}
|
|
130
|
-
document.addEventListener('focusin', handleGlobalFocusIn, true);
|
|
131
|
-
focusFirstAvailableOtpInput();
|
|
132
|
-
const rootEl = otpRoot.value;
|
|
133
|
-
rootEl && rootEl.addEventListener('focusout', handleFocusOut, true);
|
|
134
147
|
});
|
|
135
148
|
|
|
136
149
|
watch(route, (newRoute) => {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<div class="text-3xl text-gray-900 font-semibold
|
|
3
|
-
<p>Passkeys</p>
|
|
2
|
+
<div class="text-3xl text-gray-900 font-semibold max-w-2xl mr-6 flex-col justify-center items-center">
|
|
3
|
+
<p class="flex items-start justify-start leading-none">Passkeys</p>
|
|
4
4
|
<div class="flex flex-col items-end">
|
|
5
5
|
<Table
|
|
6
6
|
class="mt-4 w-full"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
|
|
68
68
|
<script setup lang="ts">
|
|
69
69
|
|
|
70
|
-
import { onMounted, onBeforeUnmount, nextTick, ref, watchEffect,computed,watch } from 'vue';
|
|
70
|
+
import { onMounted, onBeforeUnmount, nextTick, ref, watchEffect,computed,watch, onBeforeMount } from 'vue';
|
|
71
71
|
import { useCoreStore } from '@/stores/core';
|
|
72
72
|
import { useUserStore } from '@/stores/user';
|
|
73
73
|
import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbite';
|
|
@@ -86,6 +86,16 @@ import ErrorMessage from '@/components/ErrorMessage.vue';
|
|
|
86
86
|
const { t } = useI18n();
|
|
87
87
|
const route = useRoute()
|
|
88
88
|
|
|
89
|
+
onBeforeMount(() => {
|
|
90
|
+
if (localStorage.getItem('isAuthorized') === 'true') {
|
|
91
|
+
coreStore.fetchMenuAndResource();
|
|
92
|
+
if (route.query.next) {
|
|
93
|
+
router.push(route.query.next.toString());
|
|
94
|
+
} else {
|
|
95
|
+
router.push({ name: 'home' });
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
})
|
|
89
99
|
|
|
90
100
|
const code = ref(null);
|
|
91
101
|
const codeError = ref(null);
|
package/dist/index.js
CHANGED
|
@@ -71,7 +71,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
71
71
|
const response = JSON.parse(body.response);
|
|
72
72
|
try {
|
|
73
73
|
if (settingsOrigin !== expectedOrigin) {
|
|
74
|
-
throw new Error(
|
|
74
|
+
throw new Error(`Origin mismatch. Allowed in settings: ${settingsOrigin}, received from client: ${expectedOrigin}`);
|
|
75
75
|
}
|
|
76
76
|
const cred = yield this.adminforth.resource(this.options.passkeys.credentialResourceID).get([Filters.EQ(this.options.passkeys.credentialIdFieldName, response.id)]);
|
|
77
77
|
if (!cred) {
|
|
@@ -92,7 +92,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
92
92
|
const { verified, authenticationInfo } = yield verifyAuthenticationResponse({
|
|
93
93
|
response,
|
|
94
94
|
expectedChallenge,
|
|
95
|
-
expectedOrigin,
|
|
95
|
+
expectedOrigin: settingsOrigin,
|
|
96
96
|
expectedRPID,
|
|
97
97
|
credential: {
|
|
98
98
|
id: cred[this.options.passkeys.credentialIdFieldName],
|
|
@@ -125,11 +125,11 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
125
125
|
const customPages = this.adminforth.config.customization.customPages;
|
|
126
126
|
customPages.push({
|
|
127
127
|
path: '/confirm2fa',
|
|
128
|
-
component: { file: this.componentPath('TwoFactorsConfirmation.vue'), meta: {
|
|
128
|
+
component: { file: this.componentPath('TwoFactorsConfirmation.vue'), meta: { sidebarAndHeader: "none", suggestionPeriod: suggestionPeriod, isPasskeysEnabled: isPasskeysEnabled } }
|
|
129
129
|
});
|
|
130
130
|
customPages.push({
|
|
131
131
|
path: '/setup2fa',
|
|
132
|
-
component: { file: this.componentPath('TwoFactorsSetup.vue'), meta: { title: 'Setup 2FA',
|
|
132
|
+
component: { file: this.componentPath('TwoFactorsSetup.vue'), meta: { title: 'Setup 2FA', sidebarAndHeader: "none", suggestionPeriod: suggestionPeriod, isPasskeysEnabled: isPasskeysEnabled } }
|
|
133
133
|
});
|
|
134
134
|
const everyPageBottomInjections = this.adminforth.config.customization.globalInjections.everyPageBottom || [];
|
|
135
135
|
everyPageBottomInjections.push({ file: this.componentPath('TwoFAModal.vue'), meta: {} });
|
package/index.ts
CHANGED
|
@@ -80,7 +80,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
80
80
|
const response = JSON.parse(body.response);
|
|
81
81
|
try {
|
|
82
82
|
if (settingsOrigin !== expectedOrigin) {
|
|
83
|
-
throw new Error(
|
|
83
|
+
throw new Error(`Origin mismatch. Allowed in settings: ${settingsOrigin}, received from client: ${expectedOrigin}`);
|
|
84
84
|
}
|
|
85
85
|
const cred = await this.adminforth.resource(this.options.passkeys.credentialResourceID).get([Filters.EQ(this.options.passkeys.credentialIdFieldName, response.id)]);
|
|
86
86
|
if (!cred) {
|
|
@@ -101,7 +101,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
101
101
|
const { verified, authenticationInfo } = await verifyAuthenticationResponse({
|
|
102
102
|
response,
|
|
103
103
|
expectedChallenge,
|
|
104
|
-
expectedOrigin,
|
|
104
|
+
expectedOrigin: settingsOrigin,
|
|
105
105
|
expectedRPID,
|
|
106
106
|
credential: {
|
|
107
107
|
id: cred[this.options.passkeys.credentialIdFieldName],
|
|
@@ -134,11 +134,11 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
134
134
|
const customPages = this.adminforth.config.customization.customPages
|
|
135
135
|
customPages.push({
|
|
136
136
|
path:'/confirm2fa',
|
|
137
|
-
component: { file: this.componentPath('TwoFactorsConfirmation.vue'), meta: {
|
|
137
|
+
component: { file: this.componentPath('TwoFactorsConfirmation.vue'), meta: { sidebarAndHeader: "none", suggestionPeriod: suggestionPeriod, isPasskeysEnabled: isPasskeysEnabled } }
|
|
138
138
|
})
|
|
139
139
|
customPages.push({
|
|
140
140
|
path:'/setup2fa',
|
|
141
|
-
component: { file: this.componentPath('TwoFactorsSetup.vue'), meta: { title: 'Setup 2FA',
|
|
141
|
+
component: { file: this.componentPath('TwoFactorsSetup.vue'), meta: { title: 'Setup 2FA', sidebarAndHeader: "none", suggestionPeriod: suggestionPeriod, isPasskeysEnabled: isPasskeysEnabled } }
|
|
142
142
|
})
|
|
143
143
|
const everyPageBottomInjections = this.adminforth.config.customization.globalInjections.everyPageBottom || []
|
|
144
144
|
everyPageBottomInjections.push({ file: this.componentPath('TwoFAModal.vue'), meta: {} })
|