@adminforth/two-factors-auth 2.0.1 → 2.0.3
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/TwoFAModal.vue +2 -0
- package/custom/TwoFactorsConfirmation.vue +12 -4
- package/dist/custom/TwoFAModal.vue +2 -0
- package/dist/custom/TwoFactorsConfirmation.vue +12 -4
- package/dist/index.js +4 -1
- package/index.ts +4 -1
- package/package.json +1 -1
package/build.log
CHANGED
|
@@ -13,5 +13,5 @@ custom/package.json
|
|
|
13
13
|
custom/tsconfig.json
|
|
14
14
|
custom/utils.js
|
|
15
15
|
|
|
16
|
-
sent 68,
|
|
17
|
-
total size is
|
|
16
|
+
sent 68,919 bytes received 172 bytes 138,182.00 bytes/sec
|
|
17
|
+
total size is 68,279 speedup is 0.99
|
package/custom/TwoFAModal.vue
CHANGED
|
@@ -143,6 +143,7 @@
|
|
|
143
143
|
mode: "passkey",
|
|
144
144
|
result: passkeyData
|
|
145
145
|
}
|
|
146
|
+
customDialogTitle.value = "";
|
|
146
147
|
resolveFn(dataToReturn);
|
|
147
148
|
}
|
|
148
149
|
|
|
@@ -193,6 +194,7 @@
|
|
|
193
194
|
mode: "totp",
|
|
194
195
|
result: value
|
|
195
196
|
}
|
|
197
|
+
customDialogTitle.value = "";
|
|
196
198
|
resolveFn(dataToReturn);
|
|
197
199
|
}
|
|
198
200
|
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
<div v-if="isLoading===false" id="authentication-modal" tabindex="-1" class="af-two-factors-confirmation overflow-y-auto overflow-x-hidden z-50 min-w-[00px] justify-center items-center md:inset-0 h-[calc(100%-1rem)] max-h-full">
|
|
12
12
|
<div class="relative p-4 w-full max-w-md max-h-full">
|
|
13
13
|
<!-- Modal content -->
|
|
14
|
-
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" >
|
|
14
|
+
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" :class="codeError ? 'rounded-b-none' : ''">
|
|
15
15
|
<div class="p-8 w-full max-w-md max-h-full custom-auth-wrapper" >
|
|
16
16
|
<div v-if="confirmationMode === 'code'">
|
|
17
|
-
<div id="mfaCode-label" class="
|
|
18
|
-
<div class="
|
|
17
|
+
<div id="mfaCode-label" class="mx-4">{{$t('Please enter your authenticator code')}} </div>
|
|
18
|
+
<div class="mt-4 w-full flex flex-col gap-4 justify-center" ref="otpRoot">
|
|
19
19
|
<v-otp-input
|
|
20
20
|
ref="code"
|
|
21
21
|
container-class="grid grid-cols-6 gap-3 w-full"
|
|
@@ -64,8 +64,16 @@
|
|
|
64
64
|
</div>
|
|
65
65
|
</div>
|
|
66
66
|
</div>
|
|
67
|
-
<ErrorMessage :error="codeError" />
|
|
68
67
|
</div>
|
|
68
|
+
<div
|
|
69
|
+
v-if="codeError"
|
|
70
|
+
class="relative top-full left-0 bg-red-100 text-red-700 text-sm px-2 py-2 rounded-b-lg shadow"
|
|
71
|
+
>
|
|
72
|
+
<p class="pl-6">{{ codeError }} </p>
|
|
73
|
+
</div>
|
|
74
|
+
<div v-else class="h-[36px]">
|
|
75
|
+
|
|
76
|
+
</div>
|
|
69
77
|
</div>
|
|
70
78
|
</div>
|
|
71
79
|
<div v-else>
|
|
@@ -143,6 +143,7 @@
|
|
|
143
143
|
mode: "passkey",
|
|
144
144
|
result: passkeyData
|
|
145
145
|
}
|
|
146
|
+
customDialogTitle.value = "";
|
|
146
147
|
resolveFn(dataToReturn);
|
|
147
148
|
}
|
|
148
149
|
|
|
@@ -193,6 +194,7 @@
|
|
|
193
194
|
mode: "totp",
|
|
194
195
|
result: value
|
|
195
196
|
}
|
|
197
|
+
customDialogTitle.value = "";
|
|
196
198
|
resolveFn(dataToReturn);
|
|
197
199
|
}
|
|
198
200
|
|
|
@@ -11,11 +11,11 @@
|
|
|
11
11
|
<div v-if="isLoading===false" id="authentication-modal" tabindex="-1" class="af-two-factors-confirmation overflow-y-auto overflow-x-hidden z-50 min-w-[00px] justify-center items-center md:inset-0 h-[calc(100%-1rem)] max-h-full">
|
|
12
12
|
<div class="relative p-4 w-full max-w-md max-h-full">
|
|
13
13
|
<!-- Modal content -->
|
|
14
|
-
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" >
|
|
14
|
+
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" :class="codeError ? 'rounded-b-none' : ''">
|
|
15
15
|
<div class="p-8 w-full max-w-md max-h-full custom-auth-wrapper" >
|
|
16
16
|
<div v-if="confirmationMode === 'code'">
|
|
17
|
-
<div id="mfaCode-label" class="
|
|
18
|
-
<div class="
|
|
17
|
+
<div id="mfaCode-label" class="mx-4">{{$t('Please enter your authenticator code')}} </div>
|
|
18
|
+
<div class="mt-4 w-full flex flex-col gap-4 justify-center" ref="otpRoot">
|
|
19
19
|
<v-otp-input
|
|
20
20
|
ref="code"
|
|
21
21
|
container-class="grid grid-cols-6 gap-3 w-full"
|
|
@@ -64,8 +64,16 @@
|
|
|
64
64
|
</div>
|
|
65
65
|
</div>
|
|
66
66
|
</div>
|
|
67
|
-
<ErrorMessage :error="codeError" />
|
|
68
67
|
</div>
|
|
68
|
+
<div
|
|
69
|
+
v-if="codeError"
|
|
70
|
+
class="relative top-full left-0 bg-red-100 text-red-700 text-sm px-2 py-2 rounded-b-lg shadow"
|
|
71
|
+
>
|
|
72
|
+
<p class="pl-6">{{ codeError }} </p>
|
|
73
|
+
</div>
|
|
74
|
+
<div v-else class="h-[36px]">
|
|
75
|
+
|
|
76
|
+
</div>
|
|
69
77
|
</div>
|
|
70
78
|
</div>
|
|
71
79
|
<div v-else>
|
package/dist/index.js
CHANGED
|
@@ -314,9 +314,12 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
314
314
|
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, response, cookies }) {
|
|
315
315
|
const brandNameSlug = this.adminforth.config.customization.brandNameSlug;
|
|
316
316
|
const totpTemporaryJWT = this.adminforth.auth.getCustomCookie({ cookies: cookies, name: "2FaTemporaryJWT" });
|
|
317
|
+
if (!totpTemporaryJWT) {
|
|
318
|
+
return { error: 'Login session expired. Please log in again.' };
|
|
319
|
+
}
|
|
317
320
|
const decoded = yield this.adminforth.auth.verify(totpTemporaryJWT, 'temp2FA');
|
|
318
321
|
if (!decoded) {
|
|
319
|
-
return {
|
|
322
|
+
return { error: 'Login session expired. Please log in again.' };
|
|
320
323
|
}
|
|
321
324
|
if (decoded.newSecret) {
|
|
322
325
|
// set up standard TOTP request - ensured by presence of newSecret in temp2FA token
|
package/index.ts
CHANGED
|
@@ -355,9 +355,12 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
355
355
|
handler: async ({ body, adminUser, response, cookies }) => {
|
|
356
356
|
const brandNameSlug = this.adminforth.config.customization.brandNameSlug;
|
|
357
357
|
const totpTemporaryJWT = this.adminforth.auth.getCustomCookie({cookies: cookies, name: "2FaTemporaryJWT"});
|
|
358
|
+
if (!totpTemporaryJWT) {
|
|
359
|
+
return { error: 'Login session expired. Please log in again.' }
|
|
360
|
+
}
|
|
358
361
|
const decoded = await this.adminforth.auth.verify(totpTemporaryJWT, 'temp2FA');
|
|
359
362
|
if (!decoded) {
|
|
360
|
-
return {
|
|
363
|
+
return { error: 'Login session expired. Please log in again.' }
|
|
361
364
|
}
|
|
362
365
|
|
|
363
366
|
if (decoded.newSecret) {
|