@adminforth/two-factors-auth 2.9.12 → 2.9.14
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/LoginWithPasskeyButton.vue +5 -3
- package/custom/TwoFactorsSetup.vue +2 -0
- package/custom/tsconfig.json +1 -4
- package/custom/utils.js +2 -2
- package/dist/custom/LoginWithPasskeyButton.vue +5 -3
- package/dist/custom/TwoFactorsSetup.vue +2 -0
- package/dist/custom/tsconfig.json +1 -4
- package/dist/custom/utils.js +2 -2
- package/dist/index.js +11 -0
- package/index.ts +11 -0
- package/package.json +2 -2
package/build.log
CHANGED
|
@@ -15,5 +15,5 @@ custom/package.json
|
|
|
15
15
|
custom/tsconfig.json
|
|
16
16
|
custom/utils.js
|
|
17
17
|
|
|
18
|
-
sent 273,
|
|
19
|
-
total size is 272,
|
|
18
|
+
sent 273,593 bytes received 210 bytes 547,606.00 bytes/sec
|
|
19
|
+
total size is 272,766 speedup is 1.00
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
3
|
<Button
|
|
4
|
-
class="w-full !py-
|
|
4
|
+
class="w-full !py-2"
|
|
5
5
|
@click="handleLoginWithPasskey"
|
|
6
6
|
>
|
|
7
|
-
|
|
8
|
-
<
|
|
7
|
+
<div class="flex items-center justify-center">
|
|
8
|
+
<IconShieldOutline class="w-6 h-6 mr-1" />
|
|
9
|
+
<span>{{ $t('Continue with Passkey') }}</span>
|
|
10
|
+
</div>
|
|
9
11
|
</Button>
|
|
10
12
|
|
|
11
13
|
</template>
|
|
@@ -254,6 +254,7 @@ async function sendCode (value) {
|
|
|
254
254
|
}
|
|
255
255
|
})
|
|
256
256
|
if (resp.allowedLogin) {
|
|
257
|
+
localStorage.setItem('twofa-skip-setup', 'false');
|
|
257
258
|
if ( route.meta.isPasskeysEnabled ) {
|
|
258
259
|
handlePasskeyAlert(route.meta.suggestionPeriod, router);
|
|
259
260
|
}
|
|
@@ -276,6 +277,7 @@ function handlePaste(event) {
|
|
|
276
277
|
}
|
|
277
278
|
|
|
278
279
|
const handleSkip = async () => {
|
|
280
|
+
localStorage.setItem('twofa-skip-setup', 'true');
|
|
279
281
|
const resp = await callAdminForthApi({
|
|
280
282
|
method: 'POST',
|
|
281
283
|
path: '/plugin/twofa/confirmLogin',
|
package/custom/tsconfig.json
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
3
|
+
"baseUrl": ".",
|
|
4
4
|
"paths": {
|
|
5
5
|
"@/*": [
|
|
6
|
-
// "node_modules/adminforth/dist/spa/src/*"
|
|
7
6
|
"../../../adminforth/spa/src/*"
|
|
8
7
|
],
|
|
9
8
|
"*": [
|
|
10
|
-
// "node_modules/adminforth/dist/spa/node_modules/*"
|
|
11
9
|
"../../../adminforth/spa/node_modules/*"
|
|
12
10
|
],
|
|
13
11
|
"@@/*": [
|
|
14
|
-
// "node_modules/adminforth/dist/spa/src/*"
|
|
15
12
|
"."
|
|
16
13
|
]
|
|
17
14
|
}
|
package/custom/utils.js
CHANGED
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
suggestPasskey = window.localStorage.getItem('suggestPasskey');
|
|
29
|
-
|
|
30
|
-
if ( suggestPasskey === 'true' ) {
|
|
29
|
+
let userSkippedSetup = window.localStorage.getItem('twofa-skip-setup');
|
|
30
|
+
if ( suggestPasskey === 'true' && userSkippedSetup !== 'true') {
|
|
31
31
|
adminforth.alert({
|
|
32
32
|
message: 'Do you want to add passkey?',
|
|
33
33
|
variant: 'info',
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
|
|
3
3
|
<Button
|
|
4
|
-
class="w-full !py-
|
|
4
|
+
class="w-full !py-2"
|
|
5
5
|
@click="handleLoginWithPasskey"
|
|
6
6
|
>
|
|
7
|
-
|
|
8
|
-
<
|
|
7
|
+
<div class="flex items-center justify-center">
|
|
8
|
+
<IconShieldOutline class="w-6 h-6 mr-1" />
|
|
9
|
+
<span>{{ $t('Continue with Passkey') }}</span>
|
|
10
|
+
</div>
|
|
9
11
|
</Button>
|
|
10
12
|
|
|
11
13
|
</template>
|
|
@@ -254,6 +254,7 @@ async function sendCode (value) {
|
|
|
254
254
|
}
|
|
255
255
|
})
|
|
256
256
|
if (resp.allowedLogin) {
|
|
257
|
+
localStorage.setItem('twofa-skip-setup', 'false');
|
|
257
258
|
if ( route.meta.isPasskeysEnabled ) {
|
|
258
259
|
handlePasskeyAlert(route.meta.suggestionPeriod, router);
|
|
259
260
|
}
|
|
@@ -276,6 +277,7 @@ function handlePaste(event) {
|
|
|
276
277
|
}
|
|
277
278
|
|
|
278
279
|
const handleSkip = async () => {
|
|
280
|
+
localStorage.setItem('twofa-skip-setup', 'true');
|
|
279
281
|
const resp = await callAdminForthApi({
|
|
280
282
|
method: 'POST',
|
|
281
283
|
path: '/plugin/twofa/confirmLogin',
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"baseUrl": ".",
|
|
3
|
+
"baseUrl": ".",
|
|
4
4
|
"paths": {
|
|
5
5
|
"@/*": [
|
|
6
|
-
// "node_modules/adminforth/dist/spa/src/*"
|
|
7
6
|
"../../../adminforth/spa/src/*"
|
|
8
7
|
],
|
|
9
8
|
"*": [
|
|
10
|
-
// "node_modules/adminforth/dist/spa/node_modules/*"
|
|
11
9
|
"../../../adminforth/spa/node_modules/*"
|
|
12
10
|
],
|
|
13
11
|
"@@/*": [
|
|
14
|
-
// "node_modules/adminforth/dist/spa/src/*"
|
|
15
12
|
"."
|
|
16
13
|
]
|
|
17
14
|
}
|
package/dist/custom/utils.js
CHANGED
|
@@ -26,8 +26,8 @@
|
|
|
26
26
|
}
|
|
27
27
|
}
|
|
28
28
|
suggestPasskey = window.localStorage.getItem('suggestPasskey');
|
|
29
|
-
|
|
30
|
-
if ( suggestPasskey === 'true' ) {
|
|
29
|
+
let userSkippedSetup = window.localStorage.getItem('twofa-skip-setup');
|
|
30
|
+
if ( suggestPasskey === 'true' && userSkippedSetup !== 'true') {
|
|
31
31
|
adminforth.alert({
|
|
32
32
|
message: 'Do you want to add passkey?',
|
|
33
33
|
variant: 'info',
|
package/dist/index.js
CHANGED
|
@@ -207,6 +207,13 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
207
207
|
pageLabel: 'Passkeys',
|
|
208
208
|
slug: 'passkeys',
|
|
209
209
|
component: this.componentPath('TwoFactorsPasskeysSettings.vue'),
|
|
210
|
+
isVisible: (adminUser) => {
|
|
211
|
+
const secret = adminUser.dbUser[this.options.twoFaSecretFieldName];
|
|
212
|
+
if (!secret || secret.length === 0) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
return true;
|
|
216
|
+
}
|
|
210
217
|
});
|
|
211
218
|
if (this.options.passkeys.allowLoginWithPasskeys !== false) {
|
|
212
219
|
this.options.passkeys.allowLoginWithPasskeys = true;
|
|
@@ -648,6 +655,10 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
648
655
|
if (decodedPasskeysCookies.user_id !== adminUser.pk) {
|
|
649
656
|
return { error: 'Invalid user' };
|
|
650
657
|
}
|
|
658
|
+
const secret = adminUser.dbUser[this.options.twoFaSecretFieldName];
|
|
659
|
+
if (!secret || secret.length === 0) {
|
|
660
|
+
return { error: 'TOTP must be set up before registering a passkey' };
|
|
661
|
+
}
|
|
651
662
|
const settingsOrigin = (_b = this.options.passkeys) === null || _b === void 0 ? void 0 : _b.settings.expectedOrigin;
|
|
652
663
|
const expectedOrigin = body.origin;
|
|
653
664
|
const expectedChallenge = decodedPasskeysCookies.challenge;
|
package/index.ts
CHANGED
|
@@ -219,6 +219,13 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
219
219
|
pageLabel: 'Passkeys',
|
|
220
220
|
slug: 'passkeys',
|
|
221
221
|
component: this.componentPath('TwoFactorsPasskeysSettings.vue'),
|
|
222
|
+
isVisible: (adminUser: AdminUser) => {
|
|
223
|
+
const secret = adminUser.dbUser[this.options.twoFaSecretFieldName]
|
|
224
|
+
if (!secret || secret.length === 0) {
|
|
225
|
+
return false;
|
|
226
|
+
}
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
222
229
|
});
|
|
223
230
|
|
|
224
231
|
if ( this.options.passkeys.allowLoginWithPasskeys !== false ) {
|
|
@@ -701,6 +708,10 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
701
708
|
if (decodedPasskeysCookies.user_id !== adminUser.pk) {
|
|
702
709
|
return { error: 'Invalid user' };
|
|
703
710
|
}
|
|
711
|
+
const secret = adminUser.dbUser[this.options.twoFaSecretFieldName]
|
|
712
|
+
if (!secret || secret.length === 0) {
|
|
713
|
+
return { error: 'TOTP must be set up before registering a passkey' };
|
|
714
|
+
}
|
|
704
715
|
const settingsOrigin = this.options.passkeys?.settings.expectedOrigin;
|
|
705
716
|
const expectedOrigin = body.origin;
|
|
706
717
|
const expectedChallenge = decodedPasskeysCookies.challenge;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/two-factors-auth",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.14",
|
|
4
4
|
"description": "AdminForth plugin for two factors authentication",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"license": "ISC",
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@simplewebauthn/server": "^13.2.1",
|
|
29
|
-
"adminforth": "^2.4.0-next.
|
|
29
|
+
"adminforth": "^2.4.0-next.321",
|
|
30
30
|
"node-2fa": "^2.0.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|