@adminforth/two-factors-auth 1.0.32 → 1.1.0
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/.woodpecker/buildRelease.sh +13 -0
- package/.woodpecker/buildSlackNotify.sh +44 -0
- package/.woodpecker/release.yml +43 -0
- package/CHANGELOG.md +5 -0
- package/LICENSE +21 -0
- package/build.log +4 -0
- package/custom/TwoFactorsConfirmation.vue +2 -2
- package/custom/TwoFactorsSetup.vue +8 -6
- package/custom/tsconfig.json +19 -0
- package/dist/index.js +20 -13
- package/index.ts +29 -16
- package/package.json +42 -3
- package/types.ts +7 -1
- package/Changelog.md +0 -23
- package/dist/custom/TwoFactorsConfirmation.vue +0 -175
- package/dist/custom/TwoFactorsOtp.vue +0 -0
- package/dist/custom/TwoFactorsSetup.vue +0 -205
- package/dist/custom/package-lock.json +0 -301
- package/dist/custom/package.json +0 -16
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
|
|
2
|
+
#!/bin/bash
|
|
3
|
+
|
|
4
|
+
# write npm run output both to console and to build.log
|
|
5
|
+
npm run build 2>&1 | tee build.log
|
|
6
|
+
build_status=${PIPESTATUS[0]}
|
|
7
|
+
|
|
8
|
+
# if exist status from the npm run build is not 0
|
|
9
|
+
# then exit with the status code from the npm run build
|
|
10
|
+
if [ $build_status -ne 0 ]; then
|
|
11
|
+
echo "Build failed. Exiting with status code $build_status"
|
|
12
|
+
exit $build_status
|
|
13
|
+
fi
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
|
|
3
|
+
set -x
|
|
4
|
+
|
|
5
|
+
COMMIT_SHORT_SHA=$(echo $CI_COMMIT_SHA | cut -c1-8)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
if [ "$CI_STEP_STATUS" = "success" ]; then
|
|
9
|
+
MESSAGE="Did a build without issues on \`$CI_REPO_NAME/$CI_COMMIT_BRANCH\`. Commit: _${CI_COMMIT_MESSAGE}_ (<$CI_COMMIT_URL|$COMMIT_SHORT_SHA>)"
|
|
10
|
+
|
|
11
|
+
curl -s -X POST -H "Content-Type: application/json" -d '{
|
|
12
|
+
"username": "'"$CI_COMMIT_AUTHOR"'",
|
|
13
|
+
"icon_url": "'"$CI_COMMIT_AUTHOR_AVATAR"'",
|
|
14
|
+
"attachments": [
|
|
15
|
+
{
|
|
16
|
+
"mrkdwn_in": ["text", "pretext"],
|
|
17
|
+
"color": "#36a64f",
|
|
18
|
+
"text": "'"$MESSAGE"'"
|
|
19
|
+
}
|
|
20
|
+
]
|
|
21
|
+
}' "$DEVELOPERS_SLACK_WEBHOOK"
|
|
22
|
+
exit 0
|
|
23
|
+
fi
|
|
24
|
+
export BUILD_LOG=$(cat ./build.log)
|
|
25
|
+
|
|
26
|
+
BUILD_LOG=$(echo $BUILD_LOG | sed 's/"/\\"/g')
|
|
27
|
+
|
|
28
|
+
MESSAGE="Broke \`$CI_REPO_NAME/$CI_COMMIT_BRANCH\` with commit _${CI_COMMIT_MESSAGE}_ (<$CI_COMMIT_URL|$COMMIT_SHORT_SHA>)"
|
|
29
|
+
CODE_BLOCK="\`\`\`$BUILD_LOG\n\`\`\`"
|
|
30
|
+
|
|
31
|
+
echo "Sending slack message to developers $MESSAGE"
|
|
32
|
+
# Send the message
|
|
33
|
+
curl -sS -X POST -H "Content-Type: application/json" -d '{
|
|
34
|
+
"username": "'"$CI_COMMIT_AUTHOR"'",
|
|
35
|
+
"icon_url": "'"$CI_COMMIT_AUTHOR_AVATAR"'",
|
|
36
|
+
"attachments": [
|
|
37
|
+
{
|
|
38
|
+
"mrkdwn_in": ["text", "pretext"],
|
|
39
|
+
"color": "#8A1C12",
|
|
40
|
+
"text": "'"$CODE_BLOCK"'",
|
|
41
|
+
"pretext": "'"$MESSAGE"'"
|
|
42
|
+
}
|
|
43
|
+
]
|
|
44
|
+
}' "$DEVELOPERS_SLACK_WEBHOOK" 2>&1
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
clone:
|
|
2
|
+
git:
|
|
3
|
+
image: woodpeckerci/plugin-git
|
|
4
|
+
settings:
|
|
5
|
+
partial: false
|
|
6
|
+
depth: 5
|
|
7
|
+
|
|
8
|
+
steps:
|
|
9
|
+
init-secrets:
|
|
10
|
+
when:
|
|
11
|
+
- event: push
|
|
12
|
+
image: infisical/cli
|
|
13
|
+
environment:
|
|
14
|
+
INFISICAL_TOKEN:
|
|
15
|
+
from_secret: VAULT_TOKEN
|
|
16
|
+
commands:
|
|
17
|
+
- infisical export --domain https://vault.devforth.io/api --format=dotenv-export --env="prod" > /woodpecker/deploy.vault.env
|
|
18
|
+
secrets:
|
|
19
|
+
- VAULT_TOKEN
|
|
20
|
+
|
|
21
|
+
release:
|
|
22
|
+
image: node:20
|
|
23
|
+
when:
|
|
24
|
+
- event: push
|
|
25
|
+
volumes:
|
|
26
|
+
- /var/run/docker.sock:/var/run/docker.sock
|
|
27
|
+
commands:
|
|
28
|
+
- export $(cat /woodpecker/deploy.vault.env | xargs)
|
|
29
|
+
- npm clean-install
|
|
30
|
+
- /bin/bash ./.woodpecker/buildRelease.sh
|
|
31
|
+
- npm audit signatures
|
|
32
|
+
- npx semantic-release
|
|
33
|
+
|
|
34
|
+
slack-on-failure:
|
|
35
|
+
when:
|
|
36
|
+
- event: push
|
|
37
|
+
status: [failure, success]
|
|
38
|
+
- event: push
|
|
39
|
+
image: curlimages/curl
|
|
40
|
+
commands:
|
|
41
|
+
- export $(cat /woodpecker/deploy.vault.env | xargs)
|
|
42
|
+
- /bin/sh ./.woodpecker/buildSlackNotify.sh
|
|
43
|
+
|
package/CHANGELOG.md
ADDED
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Devforth.io
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/build.log
ADDED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<!-- Modal content -->
|
|
14
14
|
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" >
|
|
15
15
|
<div class="p-8 w-full max-w-md max-h-full" >
|
|
16
|
-
<div class="m-3">Please enter your authenticator code </div>
|
|
16
|
+
<div class="m-3">{{$t('Please enter your authenticator code')}} </div>
|
|
17
17
|
<div class="my-4 flex justify-center items-center">
|
|
18
18
|
<v-otp-input
|
|
19
19
|
ref="code"
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
/>
|
|
29
29
|
</div>
|
|
30
30
|
<!-- <Vue2FACodeInput v-model="code"/> -->
|
|
31
|
-
<LinkButton to="/login" class="w-full">Back to login</LinkButton>
|
|
31
|
+
<LinkButton to="/login" class="w-full">{{$t('Back to login')}}</LinkButton>
|
|
32
32
|
</div>
|
|
33
33
|
</div>
|
|
34
34
|
</div>
|
|
@@ -13,15 +13,15 @@
|
|
|
13
13
|
<!-- Modal content -->
|
|
14
14
|
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" >
|
|
15
15
|
<div class="p-8 w-full max-w-md max-h-full" >
|
|
16
|
-
<div class="m-3" >Scan this QR code with your authenticator app or open by <a class="text-blue-600" :href="totpUri">click</a></div>
|
|
16
|
+
<div class="m-3" >{{$t('Scan this QR code with your authenticator app or open by')}} <a class="text-blue-600" :href="totpUri">{{$t('click')}}</a></div>
|
|
17
17
|
<div class="flex justify-center m-3" >
|
|
18
18
|
<img :src="totpQrCode" alt="QR code" />
|
|
19
19
|
</div>
|
|
20
20
|
<div class="m-3 ">
|
|
21
|
-
<div class="m-1">Or copy this code to app manually
|
|
21
|
+
<div class="m-1">{{$t('Or copy this code to app manually:')}}</div>
|
|
22
22
|
<div class="w-full max-w-[46rem]">
|
|
23
23
|
<div class="relative">
|
|
24
|
-
<label for="npm-install-copy-text" class="sr-only">Label</label>
|
|
24
|
+
<label for="npm-install-copy-text" class="sr-only">{{$t('Label')}}</label>
|
|
25
25
|
<input id="npm-install-copy-text" type="text" class="col-span-10 bg-gray-50 border border-gray-300 text-gray-500 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full px-2.5 py-4 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 pr-12" :value="totp.newSecret" readonly>
|
|
26
26
|
<button @click="onCopyClick" data-copy-to-clipboard-target="npm-install-copy-text" class="absolute end-2.5 top-1/2 -translate-y-1/2 text-gray-900 dark:text-gray-400 hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-600 dark:hover:bg-gray-700 rounded-lg py-2 px-2.5 inline-flex items-center justify-center bg-white border-gray-200 border">
|
|
27
27
|
<span id="default-message" class="inline-flex items-center">
|
|
@@ -48,10 +48,10 @@
|
|
|
48
48
|
<!-- <Vue2FACodeInput v-model="code" autofocus /> -->
|
|
49
49
|
<div class="flex flex-row gap-2.5">
|
|
50
50
|
<LinkButton to="/login" class="w-full">
|
|
51
|
-
Back to login
|
|
51
|
+
{{$t('Back to login')}}
|
|
52
52
|
</LinkButton>
|
|
53
53
|
<Button v-if="skipAllowed" @click="handleSkip" class="w-full">
|
|
54
|
-
Skip for now
|
|
54
|
+
{{$t('Skip for now')}}
|
|
55
55
|
</Button>
|
|
56
56
|
</div>
|
|
57
57
|
</div>
|
|
@@ -76,6 +76,8 @@ import { showErrorTost } from '@/composables/useFrontendApi';
|
|
|
76
76
|
import { Button, LinkButton } from '@/afcl';
|
|
77
77
|
import Vue2FACodeInput from '@loltech/vue3-2fa-code-input';
|
|
78
78
|
import VOtpInput from "vue3-otp-input";
|
|
79
|
+
import adminforth from '@/adminforth';
|
|
80
|
+
|
|
79
81
|
|
|
80
82
|
const code = ref(null);
|
|
81
83
|
const handleOnComplete = (value) => {
|
|
@@ -122,7 +124,7 @@ function parseJwt(token) {
|
|
|
122
124
|
|
|
123
125
|
function onCopyClick(){
|
|
124
126
|
navigator.clipboard.writeText(totp.value.newSecret);
|
|
125
|
-
|
|
127
|
+
adminforth.alert({message: 'Copied to clipboard', variant: 'success'})
|
|
126
128
|
}
|
|
127
129
|
|
|
128
130
|
onMounted(async () => {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"baseUrl": ".", // This should point to your project root
|
|
4
|
+
"paths": {
|
|
5
|
+
"@/*": [
|
|
6
|
+
// "node_modules/adminforth/dist/spa/src/*"
|
|
7
|
+
"../../../spa/src/*"
|
|
8
|
+
],
|
|
9
|
+
"*": [
|
|
10
|
+
// "node_modules/adminforth/dist/spa/node_modules/*"
|
|
11
|
+
"../../../spa/node_modules/*"
|
|
12
|
+
],
|
|
13
|
+
"@@/*": [
|
|
14
|
+
// "node_modules/adminforth/dist/spa/src/*"
|
|
15
|
+
"."
|
|
16
|
+
]
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -39,6 +39,10 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
39
39
|
if (typeof this.options.twoFaSecretFieldName !== 'string') {
|
|
40
40
|
throw new Error('twoFaSecretFieldName must be a string');
|
|
41
41
|
}
|
|
42
|
+
if (this.options.timeStepWindow === undefined
|
|
43
|
+
|| typeof this.options.timeStepWindow !== 'number'
|
|
44
|
+
|| this.options.timeStepWindow < 0)
|
|
45
|
+
this.options.timeStepWindow = 1;
|
|
42
46
|
this.authResource = resourceConfig;
|
|
43
47
|
if (!this.authResource.columns.some((col) => col.name === this.options.twoFaSecretFieldName)) {
|
|
44
48
|
throw new Error(`Column ${this.options.twoFaSecretFieldName} not found in ${this.authResource.label}`);
|
|
@@ -47,6 +51,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
47
51
|
const secret = adminUser.dbUser[this.options.twoFaSecretFieldName];
|
|
48
52
|
const userName = adminUser.dbUser[adminforth.config.auth.usernameField];
|
|
49
53
|
const brandName = adminforth.config.customization.brandName;
|
|
54
|
+
const brandNameSlug = adminforth.config.customization.brandNameSlug;
|
|
50
55
|
const authResource = adminforth.config.resources.find((res) => res.resourceId === adminforth.config.auth.usersResourceId);
|
|
51
56
|
const authPk = authResource.columns.find((col) => col.primaryKey).name;
|
|
52
57
|
const userPk = adminUser.dbUser[authPk];
|
|
@@ -62,7 +67,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
62
67
|
}
|
|
63
68
|
else {
|
|
64
69
|
const value = this.adminforth.auth.issueJWT({ userName, issuer: brandName, pk: userPk, userCanSkipSetup }, 'tempTotp', '2h');
|
|
65
|
-
response.setHeader('Set-Cookie', `
|
|
70
|
+
response.setHeader('Set-Cookie', `adminforth_${brandNameSlug}_totpTemporaryJWT=${value}; Path=${this.adminforth.config.baseUrl || '/'}; HttpOnly; SameSite=Strict; max-age=3600; `);
|
|
66
71
|
return {
|
|
67
72
|
body: {
|
|
68
73
|
loginAllowed: false,
|
|
@@ -72,7 +77,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
72
77
|
};
|
|
73
78
|
}
|
|
74
79
|
const totpTemporaryJWT = this.adminforth.auth.issueJWT({ userName, newSecret, issuer: brandName, pk: userPk, userCanSkipSetup }, 'tempTotp', '2h');
|
|
75
|
-
response.setHeader('Set-Cookie', `
|
|
80
|
+
response.setHeader('Set-Cookie', `adminforth_${brandNameSlug}_totpTemporaryJWT=${totpTemporaryJWT}; Path=${this.adminforth.config.baseUrl || '/'}; HttpOnly; SameSite=Strict; Expires=${new Date(Date.now() + '1h').toUTCString()} `);
|
|
76
81
|
return {
|
|
77
82
|
body: {
|
|
78
83
|
loginAllowed: false,
|
|
@@ -90,7 +95,8 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
90
95
|
handler: (server) => __awaiter(this, void 0, void 0, function* () {
|
|
91
96
|
var _a;
|
|
92
97
|
const toReturn = { totpJWT: null, status: 'ok', };
|
|
93
|
-
const
|
|
98
|
+
const brandNameSlug = this.adminforth.config.customization.brandNameSlug;
|
|
99
|
+
const totpTemporaryJWT = (_a = server.cookies.find((cookie) => cookie.key === `adminforth_${brandNameSlug}_totpTemporaryJWT`)) === null || _a === void 0 ? void 0 : _a.value;
|
|
94
100
|
if (totpTemporaryJWT) {
|
|
95
101
|
toReturn.totpJWT = totpTemporaryJWT;
|
|
96
102
|
}
|
|
@@ -101,15 +107,15 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
101
107
|
method: 'POST',
|
|
102
108
|
path: `/plugin/twofa/confirmSetup`,
|
|
103
109
|
noAuth: true,
|
|
104
|
-
handler: (
|
|
105
|
-
var
|
|
106
|
-
const
|
|
110
|
+
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ body, adminUser, response, cookies }) {
|
|
111
|
+
var _b;
|
|
112
|
+
const brandNameSlug = this.adminforth.config.customization.brandNameSlug;
|
|
113
|
+
const totpTemporaryJWT = (_b = cookies.find((cookie) => cookie.key === `adminforth_${brandNameSlug}_totpTemporaryJWT`)) === null || _b === void 0 ? void 0 : _b.value;
|
|
107
114
|
const decoded = yield this.adminforth.auth.verify(totpTemporaryJWT, 'tempTotp');
|
|
108
|
-
if (!decoded)
|
|
115
|
+
if (!decoded)
|
|
109
116
|
return { status: 'error', message: 'Invalid token' };
|
|
110
|
-
}
|
|
111
117
|
if (decoded.newSecret) {
|
|
112
|
-
const verified = body.skip && decoded.userCanSkipSetup ? true : twofactor.verifyToken(decoded.newSecret, body.code);
|
|
118
|
+
const verified = body.skip && decoded.userCanSkipSetup ? true : twofactor.verifyToken(decoded.newSecret, body.code, this.options.timeStepWindow);
|
|
113
119
|
if (verified) {
|
|
114
120
|
this.connectors = this.adminforth.connectors;
|
|
115
121
|
if (!body.skip) {
|
|
@@ -129,7 +135,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
129
135
|
this.connectors = this.adminforth.connectors;
|
|
130
136
|
const connector = this.connectors[this.authResource.dataSource];
|
|
131
137
|
const user = yield connector.getRecordByPrimaryKey(this.authResource, decoded.pk);
|
|
132
|
-
const verified = twofactor.verifyToken(user[this.options.twoFaSecretFieldName], body.code);
|
|
138
|
+
const verified = twofactor.verifyToken(user[this.options.twoFaSecretFieldName], body.code, this.options.timeStepWindow);
|
|
133
139
|
if (verified) {
|
|
134
140
|
this.adminforth.auth.removeCustomCookie({ response, name: 'totpTemporaryJWT' });
|
|
135
141
|
this.adminforth.auth.setAuthCookie({ response, username: decoded.userName, pk: decoded.pk });
|
|
@@ -145,9 +151,10 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
145
151
|
method: "GET",
|
|
146
152
|
path: "/plugin/twofa/skip-allow",
|
|
147
153
|
noAuth: true,
|
|
148
|
-
handler: (
|
|
149
|
-
var
|
|
150
|
-
const
|
|
154
|
+
handler: (_a) => __awaiter(this, [_a], void 0, function* ({ cookies }) {
|
|
155
|
+
var _b;
|
|
156
|
+
const brandNameSlug = this.adminforth.config.customization.brandNameSlug;
|
|
157
|
+
const totpTemporaryJWT = (_b = cookies.find((cookie) => cookie.key === `adminforth_${brandNameSlug}_totpTemporaryJWT`)) === null || _b === void 0 ? void 0 : _b.value;
|
|
151
158
|
const decoded = yield this.adminforth.auth.verify(totpTemporaryJWT, "tempTotp");
|
|
152
159
|
if (!decoded) {
|
|
153
160
|
return { status: "error", message: "Invalid token" };
|
package/index.ts
CHANGED
|
@@ -23,6 +23,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
23
23
|
super.modifyResourceConfig(adminforth, resourceConfig);
|
|
24
24
|
this.adminforth = adminforth;
|
|
25
25
|
this.adminForthAuth = adminforth.auth;
|
|
26
|
+
|
|
26
27
|
const customPages = this.adminforth.config.customization.customPages
|
|
27
28
|
customPages.push({
|
|
28
29
|
path:'/confirm2fa',
|
|
@@ -42,6 +43,13 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
42
43
|
if (typeof this.options.twoFaSecretFieldName !=='string'){
|
|
43
44
|
throw new Error('twoFaSecretFieldName must be a string')
|
|
44
45
|
}
|
|
46
|
+
if (
|
|
47
|
+
this.options.timeStepWindow === undefined
|
|
48
|
+
|| typeof this.options.timeStepWindow !== 'number'
|
|
49
|
+
|| this.options.timeStepWindow < 0
|
|
50
|
+
)
|
|
51
|
+
this.options.timeStepWindow = 1;
|
|
52
|
+
|
|
45
53
|
this.authResource = resourceConfig
|
|
46
54
|
if(!this.authResource.columns.some((col)=>col.name === this.options.twoFaSecretFieldName)){
|
|
47
55
|
throw new Error(`Column ${this.options.twoFaSecretFieldName} not found in ${this.authResource.label}`)
|
|
@@ -50,7 +58,8 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
50
58
|
async({ adminUser, response }: { adminUser: AdminUser, response: IAdminForthHttpResponse} )=> {
|
|
51
59
|
const secret = adminUser.dbUser[this.options.twoFaSecretFieldName]
|
|
52
60
|
const userName = adminUser.dbUser[adminforth.config.auth.usernameField]
|
|
53
|
-
const brandName = adminforth.config.customization.brandName
|
|
61
|
+
const brandName = adminforth.config.customization.brandName;
|
|
62
|
+
const brandNameSlug = adminforth.config.customization.brandNameSlug;
|
|
54
63
|
const authResource = adminforth.config.resources.find((res)=>res.resourceId === adminforth.config.auth.usersResourceId )
|
|
55
64
|
const authPk = authResource.columns.find((col)=>col.primaryKey).name
|
|
56
65
|
const userPk = adminUser.dbUser[authPk]
|
|
@@ -68,7 +77,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
68
77
|
newSecret = tempSecret.secret
|
|
69
78
|
} else {
|
|
70
79
|
const value = this.adminforth.auth.issueJWT({userName, issuer:brandName, pk:userPk, userCanSkipSetup }, 'tempTotp', '2h');
|
|
71
|
-
response.setHeader('Set-Cookie', `
|
|
80
|
+
response.setHeader('Set-Cookie', `adminforth_${brandNameSlug}_totpTemporaryJWT=${value}; Path=${this.adminforth.config.baseUrl || '/'}; HttpOnly; SameSite=Strict; max-age=3600; `);
|
|
72
81
|
|
|
73
82
|
return {
|
|
74
83
|
body:{
|
|
@@ -78,13 +87,13 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
78
87
|
ok: true
|
|
79
88
|
}
|
|
80
89
|
}
|
|
81
|
-
const totpTemporaryJWT = this.adminforth.auth.issueJWT({userName, newSecret, issuer:brandName, pk:userPk, userCanSkipSetup },'tempTotp', '2h');
|
|
82
|
-
response.setHeader('Set-Cookie', `
|
|
83
|
-
|
|
84
|
-
return {
|
|
90
|
+
const totpTemporaryJWT = this.adminforth.auth.issueJWT({userName, newSecret, issuer:brandName, pk:userPk, userCanSkipSetup }, 'tempTotp', '2h');
|
|
91
|
+
response.setHeader('Set-Cookie', `adminforth_${brandNameSlug}_totpTemporaryJWT=${totpTemporaryJWT}; Path=${this.adminforth.config.baseUrl || '/'}; HttpOnly; SameSite=Strict; Expires=${new Date(Date.now() + '1h').toUTCString() } `);
|
|
92
|
+
|
|
93
|
+
return {
|
|
85
94
|
body:{
|
|
86
95
|
loginAllowed: false,
|
|
87
|
-
redirectTo: secret ? '/confirm2fa' : '/setup2fa',
|
|
96
|
+
redirectTo: secret ? '/confirm2fa' : '/setup2fa',
|
|
88
97
|
},
|
|
89
98
|
ok: true
|
|
90
99
|
}
|
|
@@ -98,8 +107,9 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
98
107
|
noAuth: true,
|
|
99
108
|
handler: async (server) => {
|
|
100
109
|
const toReturn = {totpJWT:null,status:'ok',}
|
|
110
|
+
const brandNameSlug = this.adminforth.config.customization.brandNameSlug;
|
|
101
111
|
|
|
102
|
-
const totpTemporaryJWT = server.cookies.find((cookie)=>cookie.key ===
|
|
112
|
+
const totpTemporaryJWT = server.cookies.find((cookie)=>cookie.key === `adminforth_${brandNameSlug}_totpTemporaryJWT`)?.value;
|
|
103
113
|
if (totpTemporaryJWT){
|
|
104
114
|
toReturn.totpJWT = totpTemporaryJWT
|
|
105
115
|
}
|
|
@@ -111,13 +121,15 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
111
121
|
path: `/plugin/twofa/confirmSetup`,
|
|
112
122
|
noAuth: true,
|
|
113
123
|
handler: async ({ body, adminUser, response, cookies }) => {
|
|
114
|
-
const
|
|
124
|
+
const brandNameSlug = this.adminforth.config.customization.brandNameSlug;
|
|
125
|
+
const totpTemporaryJWT = cookies.find((cookie)=>cookie.key === `adminforth_${brandNameSlug}_totpTemporaryJWT`)?.value;
|
|
115
126
|
const decoded = await this.adminforth.auth.verify(totpTemporaryJWT, 'tempTotp');
|
|
116
|
-
|
|
127
|
+
|
|
128
|
+
if (!decoded)
|
|
117
129
|
return {status:'error',message:'Invalid token'}
|
|
118
|
-
|
|
130
|
+
|
|
119
131
|
if (decoded.newSecret) {
|
|
120
|
-
const verified = body.skip && decoded.userCanSkipSetup ? true : twofactor.verifyToken(decoded.newSecret, body.code);
|
|
132
|
+
const verified = body.skip && decoded.userCanSkipSetup ? true : twofactor.verifyToken(decoded.newSecret, body.code, this.options.timeStepWindow);
|
|
121
133
|
if (verified) {
|
|
122
134
|
this.connectors = this.adminforth.connectors
|
|
123
135
|
if (!body.skip) {
|
|
@@ -135,8 +147,8 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
135
147
|
this.connectors = this.adminforth.connectors
|
|
136
148
|
const connector = this.connectors[this.authResource.dataSource];
|
|
137
149
|
const user = await connector.getRecordByPrimaryKey(this.authResource, decoded.pk)
|
|
138
|
-
const verified = twofactor.verifyToken(user[this.options.twoFaSecretFieldName], body.code);
|
|
139
|
-
if (verified) {
|
|
150
|
+
const verified = twofactor.verifyToken(user[this.options.twoFaSecretFieldName], body.code, this.options.timeStepWindow);
|
|
151
|
+
if (verified) {
|
|
140
152
|
this.adminforth.auth.removeCustomCookie({response, name:'totpTemporaryJWT'})
|
|
141
153
|
this.adminforth.auth.setAuthCookie({response, username:decoded.userName, pk:decoded.pk})
|
|
142
154
|
return { status: 'ok', allowedLogin: true }
|
|
@@ -151,12 +163,13 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
151
163
|
path: "/plugin/twofa/skip-allow",
|
|
152
164
|
noAuth: true,
|
|
153
165
|
handler: async ({ cookies }) => {
|
|
166
|
+
const brandNameSlug = this.adminforth.config.customization.brandNameSlug;
|
|
154
167
|
const totpTemporaryJWT = cookies.find(
|
|
155
|
-
(cookie) => cookie.key ===
|
|
168
|
+
(cookie) => cookie.key === `adminforth_${brandNameSlug}_totpTemporaryJWT`
|
|
156
169
|
)?.value;
|
|
157
170
|
const decoded = await this.adminforth.auth.verify(
|
|
158
171
|
totpTemporaryJWT,
|
|
159
|
-
"tempTotp"
|
|
172
|
+
"tempTotp",
|
|
160
173
|
);
|
|
161
174
|
if (!decoded) {
|
|
162
175
|
return { status: "error", message: "Invalid token" };
|
package/package.json
CHANGED
|
@@ -1,17 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adminforth/two-factors-auth",
|
|
3
|
-
"version": "1.0
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "AdminForth plugin for two factors authentication",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/devforth/adminforth-two-factors-auth.git"
|
|
10
|
+
},
|
|
7
11
|
"type": "module",
|
|
8
12
|
"scripts": {
|
|
9
|
-
"
|
|
10
|
-
"
|
|
13
|
+
"prepare": "npm link adminforth",
|
|
14
|
+
"build": "tsc"
|
|
11
15
|
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"adminforth",
|
|
18
|
+
"two-factors-auth",
|
|
19
|
+
"2fa"
|
|
20
|
+
],
|
|
12
21
|
"author": "devforth",
|
|
13
22
|
"license": "ISC",
|
|
14
23
|
"dependencies": {
|
|
15
24
|
"node-2fa": "^2.0.3"
|
|
25
|
+
},
|
|
26
|
+
"devDependencies": {
|
|
27
|
+
"@types/node": "^22.10.7",
|
|
28
|
+
"semantic-release": "^24.2.1",
|
|
29
|
+
"semantic-release-slack-bot": "^4.0.2",
|
|
30
|
+
"typescript": "^5.7.3"
|
|
31
|
+
},
|
|
32
|
+
"release": {
|
|
33
|
+
"plugins": [
|
|
34
|
+
"@semantic-release/commit-analyzer",
|
|
35
|
+
"@semantic-release/release-notes-generator",
|
|
36
|
+
"@semantic-release/npm",
|
|
37
|
+
"@semantic-release/github",
|
|
38
|
+
[
|
|
39
|
+
"semantic-release-slack-bot",
|
|
40
|
+
{
|
|
41
|
+
"notifyOnSuccess": true,
|
|
42
|
+
"notifyOnFail": true,
|
|
43
|
+
"slackIcon": ":package:",
|
|
44
|
+
"markdownReleaseNotes": true
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
],
|
|
48
|
+
"branches": [
|
|
49
|
+
"main",
|
|
50
|
+
{
|
|
51
|
+
"name": "next",
|
|
52
|
+
"prerelease": true
|
|
53
|
+
}
|
|
54
|
+
]
|
|
16
55
|
}
|
|
17
56
|
}
|
package/types.ts
CHANGED
|
@@ -3,13 +3,19 @@ import { AdminUser } from "adminforth";
|
|
|
3
3
|
export type PluginOptions = {
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Name of the field in the auth resource which will store 2FA secret.
|
|
6
|
+
* Name of the field in the auth resource which will store 2FA secret.
|
|
7
7
|
*
|
|
8
8
|
* Resource mandatory should have one columns which defined {@link AdminForthResourceColumn} which
|
|
9
9
|
* name should be equal to the value .
|
|
10
10
|
*/
|
|
11
11
|
twoFaSecretFieldName: string;
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Not-negative optional time step window for 2FA. This value means that the user will be able to enter the old code
|
|
15
|
+
* for the next 30 seconds after the new code was generated.
|
|
16
|
+
*/
|
|
17
|
+
timeStepWindow?: number;
|
|
18
|
+
|
|
13
19
|
/**
|
|
14
20
|
* Optional function to filter users to apply 2FA.
|
|
15
21
|
* Should return true if 2FA should be applied to the user and false if AdminForth should not challenge the user with 2FA.
|
package/Changelog.md
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
## [1.0.30] - 2024-12-13
|
|
2
|
-
|
|
3
|
-
### Fixed
|
|
4
|
-
|
|
5
|
-
- Fixed skip 2fa
|
|
6
|
-
|
|
7
|
-
## [1.0.20] - 2024-12-05
|
|
8
|
-
|
|
9
|
-
### Added
|
|
10
|
-
|
|
11
|
-
- Added usersFilterToAllowSkipSetup to TwoFactorsAuthPlugin to allow skip 2FA setup for specific users
|
|
12
|
-
|
|
13
|
-
## [1.0.19] - 2024-12-02
|
|
14
|
-
|
|
15
|
-
### Fixed
|
|
16
|
-
|
|
17
|
-
- Fixed copy hash for 2fa
|
|
18
|
-
|
|
19
|
-
## [1.0.18] - 2024-09-13
|
|
20
|
-
|
|
21
|
-
### Added
|
|
22
|
-
|
|
23
|
-
- add usersFilterToApply to TwoFactorsAuthPlugin to disable 2FA for specific users
|
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="relative flex items-center justify-center min-h-screen bg-gray-100 dark:bg-gray-800"
|
|
3
|
-
:style="(coreStore.config?.loginBackgroundImage && coreStore.config?.loginBackgroundPosition === 'over') ? {
|
|
4
|
-
'background-image': 'url(' + loadFile(coreStore.config?.loginBackgroundImage) + ')',
|
|
5
|
-
'background-size': 'cover',
|
|
6
|
-
'background-position': 'center',
|
|
7
|
-
'background-blend-mode': 'darken'
|
|
8
|
-
}: {}"
|
|
9
|
-
>
|
|
10
|
-
|
|
11
|
-
<div id="authentication-modal" tabindex="-1" class=" 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
|
-
<div class="relative p-4 w-full max-w-md max-h-full">
|
|
13
|
-
<!-- Modal content -->
|
|
14
|
-
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" >
|
|
15
|
-
<div class="p-8 w-full max-w-md max-h-full" >
|
|
16
|
-
<div class="m-3">Please enter your authenticator code </div>
|
|
17
|
-
<div class="my-4 flex justify-center items-center">
|
|
18
|
-
<v-otp-input
|
|
19
|
-
ref="code"
|
|
20
|
-
input-classes="bg-gray-50 text-center flex justify-center otp-input border leading-none border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-10 h-10 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
|
21
|
-
:conditionalClass="['one', 'two', 'three', 'four', 'five', 'six']"
|
|
22
|
-
inputType="number"
|
|
23
|
-
:num-inputs="6"
|
|
24
|
-
v-model:value="bindValue"
|
|
25
|
-
:should-auto-focus="true"
|
|
26
|
-
:should-focus-order="true"
|
|
27
|
-
@on-complete="handleOnComplete"
|
|
28
|
-
/>
|
|
29
|
-
</div>
|
|
30
|
-
<!-- <Vue2FACodeInput v-model="code"/> -->
|
|
31
|
-
<LinkButton to="/login" class="w-full">Back to login</LinkButton>
|
|
32
|
-
</div>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
|
|
37
|
-
</div>
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
</template>
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
<script setup>
|
|
44
|
-
|
|
45
|
-
import { onMounted, onBeforeUnmount, ref, watchEffect,computed,watch } from 'vue';
|
|
46
|
-
import { useCoreStore } from '@/stores/core';
|
|
47
|
-
import { useUserStore } from '@/stores/user';
|
|
48
|
-
import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbite';
|
|
49
|
-
import { callAdminForthApi, loadFile } from '@/utils';
|
|
50
|
-
import { useRouter } from 'vue-router';
|
|
51
|
-
import { showErrorTost } from '@/composables/useFrontendApi';
|
|
52
|
-
import { LinkButton } from '@/afcl';
|
|
53
|
-
import Vue2FACodeInput from '@loltech/vue3-2fa-code-input';
|
|
54
|
-
import VOtpInput from "vue3-otp-input";
|
|
55
|
-
|
|
56
|
-
const code = ref(null);
|
|
57
|
-
|
|
58
|
-
const handleOnComplete = (value) => {
|
|
59
|
-
sendCode(value);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const fillInput = (value) => {
|
|
63
|
-
code.value?.fillInput(value);
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
const router = useRouter();
|
|
67
|
-
const inProgress = ref(false);
|
|
68
|
-
|
|
69
|
-
const coreStore = useCoreStore();
|
|
70
|
-
const user = useUserStore();
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
// use this simple function to automatically focus on the next input
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
const showPw = ref(false);
|
|
78
|
-
|
|
79
|
-
const error = ref(null);
|
|
80
|
-
const totp = ref({});
|
|
81
|
-
const totpJWT = ref(null);
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
function parseJwt(token) {
|
|
85
|
-
// Split the token into its parts
|
|
86
|
-
const base64Url = token.split('.')[1];
|
|
87
|
-
|
|
88
|
-
// Base64-decode the payload
|
|
89
|
-
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
|
90
|
-
const jsonPayload = decodeURIComponent(atob(base64).split('').map(function(c) {
|
|
91
|
-
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
|
92
|
-
}).join(''));
|
|
93
|
-
|
|
94
|
-
// Parse the JSON payload
|
|
95
|
-
return JSON.parse(jsonPayload);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
onMounted(async () => {
|
|
99
|
-
coreStore.getPublicConfig();
|
|
100
|
-
window.addEventListener('paste', handlePaste);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
onBeforeUnmount(() => {
|
|
104
|
-
window.removeEventListener('paste', handlePaste);
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
async function sendCode (value) {
|
|
108
|
-
inProgress.value = true;
|
|
109
|
-
const resp = await callAdminForthApi({
|
|
110
|
-
method: 'POST',
|
|
111
|
-
path: '/plugin/twofa/confirmSetup',
|
|
112
|
-
body: {
|
|
113
|
-
code: value,
|
|
114
|
-
secret: null,
|
|
115
|
-
}
|
|
116
|
-
})
|
|
117
|
-
if (resp.allowedLogin){
|
|
118
|
-
await user.finishLogin();
|
|
119
|
-
} else {
|
|
120
|
-
showErrorTost('Invalid code');
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// watch(code, async (nv)=>{
|
|
125
|
-
// if (nv){
|
|
126
|
-
// sendCode();
|
|
127
|
-
// }
|
|
128
|
-
// })
|
|
129
|
-
|
|
130
|
-
function handlePaste(event) {
|
|
131
|
-
event.preventDefault();
|
|
132
|
-
if (event.target.classList.contains('otp-input')) {
|
|
133
|
-
return;
|
|
134
|
-
}
|
|
135
|
-
const pastedText = event.clipboardData?.getData('text') || '';
|
|
136
|
-
if (pastedText.length === 6) {
|
|
137
|
-
code.value?.fillInput(pastedText);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
</script>
|
|
141
|
-
|
|
142
|
-
<style lang='scss'>
|
|
143
|
-
.vue3-2fa-code-input {
|
|
144
|
-
display: flex;
|
|
145
|
-
justify-content: center;
|
|
146
|
-
gap: 1rem;
|
|
147
|
-
margin-bottom: 1rem;
|
|
148
|
-
}
|
|
149
|
-
.otp-input {
|
|
150
|
-
margin: 0 5px;
|
|
151
|
-
}
|
|
152
|
-
.vue3-2fa-code-input-box {
|
|
153
|
-
&[type='text'] {
|
|
154
|
-
@apply w-10 h-10 text-center text-xl border border-gray-300 rounded-lg focus:outline-none focus:ring-2 focus:ring-blue-500;
|
|
155
|
-
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
/**
|
|
161
|
-
* This particular piece of code makes the last input have a gap in the middle.
|
|
162
|
-
*/
|
|
163
|
-
.spaced-code-input {
|
|
164
|
-
& .vue3-2fa-code-input-box {
|
|
165
|
-
&:nth-child(3) {
|
|
166
|
-
@apply mr-4;
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
&:nth-child(4) {
|
|
170
|
-
@apply ml-4;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
</style>
|
|
175
|
-
|
|
File without changes
|
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="relative flex items-center justify-center min-h-screen bg-gray-100 dark:bg-gray-800"
|
|
3
|
-
:style="coreStore.config?.loginBackgroundImage && coreStore.config?.loginBackgroundPosition === 'over' ? {
|
|
4
|
-
'background-image': 'url(' + loadFile(coreStore.config?.loginBackgroundImage) + ')',
|
|
5
|
-
'background-size': 'cover',
|
|
6
|
-
'background-position': 'center',
|
|
7
|
-
'background-blend-mode': 'darken'
|
|
8
|
-
}: {}"
|
|
9
|
-
>
|
|
10
|
-
|
|
11
|
-
<div id="authentication-modal" tabindex="-1" class=" 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
|
-
<div class="relative p-4 w-full max-w-md max-h-full">
|
|
13
|
-
<!-- Modal content -->
|
|
14
|
-
<div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" >
|
|
15
|
-
<div class="p-8 w-full max-w-md max-h-full" >
|
|
16
|
-
<div class="m-3" >Scan this QR code with your authenticator app or open by <a class="text-blue-600" :href="totpUri">click</a></div>
|
|
17
|
-
<div class="flex justify-center m-3" >
|
|
18
|
-
<img :src="totpQrCode" alt="QR code" />
|
|
19
|
-
</div>
|
|
20
|
-
<div class="m-3 ">
|
|
21
|
-
<div class="m-1">Or copy this code to app manually:</div>
|
|
22
|
-
<div class="w-full max-w-[46rem]">
|
|
23
|
-
<div class="relative">
|
|
24
|
-
<label for="npm-install-copy-text" class="sr-only">Label</label>
|
|
25
|
-
<input id="npm-install-copy-text" type="text" class="col-span-10 bg-gray-50 border border-gray-300 text-gray-500 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full px-2.5 py-4 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-gray-400 dark:focus:ring-blue-500 dark:focus:border-blue-500 pr-12" :value="totp.newSecret" readonly>
|
|
26
|
-
<button @click="onCopyClick" data-copy-to-clipboard-target="npm-install-copy-text" class="absolute end-2.5 top-1/2 -translate-y-1/2 text-gray-900 dark:text-gray-400 hover:bg-gray-100 dark:bg-gray-800 dark:border-gray-600 dark:hover:bg-gray-700 rounded-lg py-2 px-2.5 inline-flex items-center justify-center bg-white border-gray-200 border">
|
|
27
|
-
<span id="default-message" class="inline-flex items-center">
|
|
28
|
-
<svg class="w-3 h-4" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 18 20">
|
|
29
|
-
<path d="M16 1h-3.278A1.992 1.992 0 0 0 11 0H7a1.993 1.993 0 0 0-1.722 1H2a2 2 0 0 0-2 2v15a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2Zm-3 14H5a1 1 0 0 1 0-2h8a1 1 0 0 1 0 2Zm0-4H5a1 1 0 0 1 0-2h8a1 1 0 1 1 0 2Zm0-5H5a1 1 0 0 1 0-2h2V2h4v2h2a1 1 0 1 1 0 2Z"/>
|
|
30
|
-
</svg>
|
|
31
|
-
</span>
|
|
32
|
-
</button>
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
</div>
|
|
36
|
-
<div class="my-4 flex justify-center items-center">
|
|
37
|
-
<v-otp-input
|
|
38
|
-
ref="code"
|
|
39
|
-
input-classes="bg-gray-50 text-center flex justify-center otp-input border leading-none border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-10 h-10 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
|
40
|
-
:conditionalClass="['one', 'two', 'three', 'four', 'five', 'six']"
|
|
41
|
-
inputType="number"
|
|
42
|
-
:num-inputs="6"
|
|
43
|
-
:should-auto-focus="true"
|
|
44
|
-
:should-focus-order="true"
|
|
45
|
-
@on-complete="handleOnComplete"
|
|
46
|
-
/>
|
|
47
|
-
</div>
|
|
48
|
-
<!-- <Vue2FACodeInput v-model="code" autofocus /> -->
|
|
49
|
-
<div class="flex flex-row gap-2.5">
|
|
50
|
-
<LinkButton to="/login" class="w-full">
|
|
51
|
-
Back to login
|
|
52
|
-
</LinkButton>
|
|
53
|
-
<Button v-if="skipAllowed" @click="handleSkip" class="w-full">
|
|
54
|
-
Skip for now
|
|
55
|
-
</Button>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
</div>
|
|
59
|
-
</div>
|
|
60
|
-
</div>
|
|
61
|
-
</div>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
</template>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
<script setup lang="ts">
|
|
68
|
-
|
|
69
|
-
import { onMounted, onBeforeUnmount, ref, watchEffect,computed,watch } from 'vue';
|
|
70
|
-
import { useCoreStore } from '@/stores/core';
|
|
71
|
-
import { useUserStore } from '@/stores/user';
|
|
72
|
-
import { IconEyeSolid, IconEyeSlashSolid } from '@iconify-prerendered/vue-flowbite';
|
|
73
|
-
import { callAdminForthApi, loadFile } from '@/utils';
|
|
74
|
-
import { useRouter } from 'vue-router';
|
|
75
|
-
import { showErrorTost } from '@/composables/useFrontendApi';
|
|
76
|
-
import { Button, LinkButton } from '@/afcl';
|
|
77
|
-
import Vue2FACodeInput from '@loltech/vue3-2fa-code-input';
|
|
78
|
-
import VOtpInput from "vue3-otp-input";
|
|
79
|
-
|
|
80
|
-
const code = ref(null);
|
|
81
|
-
const handleOnComplete = (value) => {
|
|
82
|
-
sendCode(value);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const router = useRouter();
|
|
86
|
-
const inProgress = ref(false);
|
|
87
|
-
|
|
88
|
-
const coreStore = useCoreStore();
|
|
89
|
-
const user = useUserStore();
|
|
90
|
-
|
|
91
|
-
const skipAllowed = ref(false);
|
|
92
|
-
|
|
93
|
-
// use this simple function to automatically focus on the next input
|
|
94
|
-
|
|
95
|
-
const showPw = ref(false);
|
|
96
|
-
|
|
97
|
-
const error = ref(null);
|
|
98
|
-
const totp = ref({});
|
|
99
|
-
const totpJWT = ref(null);
|
|
100
|
-
const totpUri = computed(() => {
|
|
101
|
-
if (totp.value) {
|
|
102
|
-
return `otpauth://totp/${totp.value.issuer}:${totp.value.userName}?secret=${totp.value.newSecret}&issuer=${totp.value.issuer}`;
|
|
103
|
-
}});
|
|
104
|
-
const totpQrCode = computed(() => {
|
|
105
|
-
if (totpUri.value) {
|
|
106
|
-
return `https://api.qrserver.com/v1/create-qr-code/?size=200x200&data=${encodeURIComponent(totpUri.value)}`;
|
|
107
|
-
}});
|
|
108
|
-
|
|
109
|
-
function parseJwt(token) {
|
|
110
|
-
// Split the token into its parts
|
|
111
|
-
const base64Url = token.split('.')[1];
|
|
112
|
-
|
|
113
|
-
// Base64-decode the payload
|
|
114
|
-
const base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/');
|
|
115
|
-
const jsonPayload = decodeURIComponent(atob(base64).split('').map(function(c) {
|
|
116
|
-
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
|
117
|
-
}).join(''));
|
|
118
|
-
|
|
119
|
-
// Parse the JSON payload
|
|
120
|
-
return JSON.parse(jsonPayload);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
function onCopyClick(){
|
|
124
|
-
navigator.clipboard.writeText(totp.value.newSecret);
|
|
125
|
-
window.adminforth.alert({message: 'Copied to clipboard', variant: 'success'})
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
onMounted(async () => {
|
|
129
|
-
coreStore.getPublicConfig()
|
|
130
|
-
const resp = await callAdminForthApi({
|
|
131
|
-
path: '/plugin/twofa/initSetup',
|
|
132
|
-
method: 'POST',});
|
|
133
|
-
if (resp && resp.totpJWT){
|
|
134
|
-
totpJWT.value = resp.totpJWT;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
totp.value=parseJwt(totpJWT.value);
|
|
138
|
-
|
|
139
|
-
const allowSkipResp = await callAdminForthApi({
|
|
140
|
-
path: '/plugin/twofa/skip-allow',
|
|
141
|
-
method: 'GET',
|
|
142
|
-
});
|
|
143
|
-
|
|
144
|
-
if (allowSkipResp?.skipAllowed){
|
|
145
|
-
skipAllowed.value = true;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
window.addEventListener('paste', handlePaste);
|
|
149
|
-
});
|
|
150
|
-
|
|
151
|
-
onBeforeUnmount(() => {
|
|
152
|
-
window.removeEventListener('paste', handlePaste);
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
async function sendCode (value) {
|
|
156
|
-
inProgress.value = true;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
const resp = await callAdminForthApi({
|
|
160
|
-
method: 'POST',
|
|
161
|
-
path: '/plugin/twofa/confirmSetup',
|
|
162
|
-
body: {
|
|
163
|
-
code: value,
|
|
164
|
-
secret: totp.value.newSecret,
|
|
165
|
-
}
|
|
166
|
-
})
|
|
167
|
-
if (resp.allowedLogin){
|
|
168
|
-
await user.finishLogin()
|
|
169
|
-
} else {
|
|
170
|
-
showErrorTost('Invalid code');
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
function handlePaste(event) {
|
|
176
|
-
event.preventDefault();
|
|
177
|
-
if (event.target.classList.contains('otp-input')) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
const pastedText = event.clipboardData?.getData('text') || '';
|
|
181
|
-
if (pastedText.length === 6) {
|
|
182
|
-
code.value?.fillInput(pastedText);
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
const handleSkip = async () => {
|
|
187
|
-
const resp = await callAdminForthApi({
|
|
188
|
-
method: 'POST',
|
|
189
|
-
path: '/plugin/twofa/confirmSetup',
|
|
190
|
-
body: {
|
|
191
|
-
skip: true,
|
|
192
|
-
}
|
|
193
|
-
});
|
|
194
|
-
if (resp.allowedLogin){
|
|
195
|
-
await user.finishLogin()
|
|
196
|
-
} else {
|
|
197
|
-
showErrorTost('Something went wrong');
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
</script>
|
|
201
|
-
<style>
|
|
202
|
-
.otp-input {
|
|
203
|
-
margin: 0 5px;
|
|
204
|
-
}
|
|
205
|
-
</style>
|
|
@@ -1,301 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "custom",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"lockfileVersion": 3,
|
|
5
|
-
"requires": true,
|
|
6
|
-
"packages": {
|
|
7
|
-
"": {
|
|
8
|
-
"name": "custom",
|
|
9
|
-
"version": "1.0.0",
|
|
10
|
-
"license": "ISC",
|
|
11
|
-
"dependencies": {
|
|
12
|
-
"@loltech/vue3-2fa-code-input": "^1.1.0",
|
|
13
|
-
"vue3-otp-input": "^0.5.21"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"node_modules/@babel/helper-string-parser": {
|
|
17
|
-
"version": "7.25.9",
|
|
18
|
-
"resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz",
|
|
19
|
-
"integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==",
|
|
20
|
-
"license": "MIT",
|
|
21
|
-
"engines": {
|
|
22
|
-
"node": ">=6.9.0"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"node_modules/@babel/helper-validator-identifier": {
|
|
26
|
-
"version": "7.25.9",
|
|
27
|
-
"resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz",
|
|
28
|
-
"integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==",
|
|
29
|
-
"license": "MIT",
|
|
30
|
-
"engines": {
|
|
31
|
-
"node": ">=6.9.0"
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
"node_modules/@babel/parser": {
|
|
35
|
-
"version": "7.25.9",
|
|
36
|
-
"resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.25.9.tgz",
|
|
37
|
-
"integrity": "sha512-aI3jjAAO1fh7vY/pBGsn1i9LDbRP43+asrRlkPuTXW5yHXtd1NgTEMudbBoDDxrf1daEEfPJqR+JBMakzrR4Dg==",
|
|
38
|
-
"license": "MIT",
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"@babel/types": "^7.25.9"
|
|
41
|
-
},
|
|
42
|
-
"bin": {
|
|
43
|
-
"parser": "bin/babel-parser.js"
|
|
44
|
-
},
|
|
45
|
-
"engines": {
|
|
46
|
-
"node": ">=6.0.0"
|
|
47
|
-
}
|
|
48
|
-
},
|
|
49
|
-
"node_modules/@babel/types": {
|
|
50
|
-
"version": "7.25.9",
|
|
51
|
-
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.25.9.tgz",
|
|
52
|
-
"integrity": "sha512-OwS2CM5KocvQ/k7dFJa8i5bNGJP0hXWfVCfDkqRFP1IreH1JDC7wG6eCYCi0+McbfT8OR/kNqsI0UU0xP9H6PQ==",
|
|
53
|
-
"license": "MIT",
|
|
54
|
-
"dependencies": {
|
|
55
|
-
"@babel/helper-string-parser": "^7.25.9",
|
|
56
|
-
"@babel/helper-validator-identifier": "^7.25.9"
|
|
57
|
-
},
|
|
58
|
-
"engines": {
|
|
59
|
-
"node": ">=6.9.0"
|
|
60
|
-
}
|
|
61
|
-
},
|
|
62
|
-
"node_modules/@jridgewell/sourcemap-codec": {
|
|
63
|
-
"version": "1.5.0",
|
|
64
|
-
"resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz",
|
|
65
|
-
"integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==",
|
|
66
|
-
"license": "MIT"
|
|
67
|
-
},
|
|
68
|
-
"node_modules/@loltech/vue3-2fa-code-input": {
|
|
69
|
-
"version": "1.1.0",
|
|
70
|
-
"resolved": "https://registry.npmjs.org/@loltech/vue3-2fa-code-input/-/vue3-2fa-code-input-1.1.0.tgz",
|
|
71
|
-
"integrity": "sha512-styyoQjsARSeVf6E5qMvYIVkLRrwYtfL8xDl5W+g9wKF8qlr2XGU2gi9maEg0X4Us41kJryXBzfRMUcv5tKIBA=="
|
|
72
|
-
},
|
|
73
|
-
"node_modules/@vue/compiler-core": {
|
|
74
|
-
"version": "3.5.12",
|
|
75
|
-
"resolved": "https://registry.npmjs.org/@vue/compiler-core/-/compiler-core-3.5.12.tgz",
|
|
76
|
-
"integrity": "sha512-ISyBTRMmMYagUxhcpyEH0hpXRd/KqDU4ymofPgl2XAkY9ZhQ+h0ovEZJIiPop13UmR/54oA2cgMDjgroRelaEw==",
|
|
77
|
-
"license": "MIT",
|
|
78
|
-
"dependencies": {
|
|
79
|
-
"@babel/parser": "^7.25.3",
|
|
80
|
-
"@vue/shared": "3.5.12",
|
|
81
|
-
"entities": "^4.5.0",
|
|
82
|
-
"estree-walker": "^2.0.2",
|
|
83
|
-
"source-map-js": "^1.2.0"
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
"node_modules/@vue/compiler-dom": {
|
|
87
|
-
"version": "3.5.12",
|
|
88
|
-
"resolved": "https://registry.npmjs.org/@vue/compiler-dom/-/compiler-dom-3.5.12.tgz",
|
|
89
|
-
"integrity": "sha512-9G6PbJ03uwxLHKQ3P42cMTi85lDRvGLB2rSGOiQqtXELat6uI4n8cNz9yjfVHRPIu+MsK6TE418Giruvgptckg==",
|
|
90
|
-
"license": "MIT",
|
|
91
|
-
"dependencies": {
|
|
92
|
-
"@vue/compiler-core": "3.5.12",
|
|
93
|
-
"@vue/shared": "3.5.12"
|
|
94
|
-
}
|
|
95
|
-
},
|
|
96
|
-
"node_modules/@vue/compiler-sfc": {
|
|
97
|
-
"version": "3.5.12",
|
|
98
|
-
"resolved": "https://registry.npmjs.org/@vue/compiler-sfc/-/compiler-sfc-3.5.12.tgz",
|
|
99
|
-
"integrity": "sha512-2k973OGo2JuAa5+ZlekuQJtitI5CgLMOwgl94BzMCsKZCX/xiqzJYzapl4opFogKHqwJk34vfsaKpfEhd1k5nw==",
|
|
100
|
-
"license": "MIT",
|
|
101
|
-
"dependencies": {
|
|
102
|
-
"@babel/parser": "^7.25.3",
|
|
103
|
-
"@vue/compiler-core": "3.5.12",
|
|
104
|
-
"@vue/compiler-dom": "3.5.12",
|
|
105
|
-
"@vue/compiler-ssr": "3.5.12",
|
|
106
|
-
"@vue/shared": "3.5.12",
|
|
107
|
-
"estree-walker": "^2.0.2",
|
|
108
|
-
"magic-string": "^0.30.11",
|
|
109
|
-
"postcss": "^8.4.47",
|
|
110
|
-
"source-map-js": "^1.2.0"
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
"node_modules/@vue/compiler-ssr": {
|
|
114
|
-
"version": "3.5.12",
|
|
115
|
-
"resolved": "https://registry.npmjs.org/@vue/compiler-ssr/-/compiler-ssr-3.5.12.tgz",
|
|
116
|
-
"integrity": "sha512-eLwc7v6bfGBSM7wZOGPmRavSWzNFF6+PdRhE+VFJhNCgHiF8AM7ccoqcv5kBXA2eWUfigD7byekvf/JsOfKvPA==",
|
|
117
|
-
"license": "MIT",
|
|
118
|
-
"dependencies": {
|
|
119
|
-
"@vue/compiler-dom": "3.5.12",
|
|
120
|
-
"@vue/shared": "3.5.12"
|
|
121
|
-
}
|
|
122
|
-
},
|
|
123
|
-
"node_modules/@vue/reactivity": {
|
|
124
|
-
"version": "3.5.12",
|
|
125
|
-
"resolved": "https://registry.npmjs.org/@vue/reactivity/-/reactivity-3.5.12.tgz",
|
|
126
|
-
"integrity": "sha512-UzaN3Da7xnJXdz4Okb/BGbAaomRHc3RdoWqTzlvd9+WBR5m3J39J1fGcHes7U3za0ruYn/iYy/a1euhMEHvTAg==",
|
|
127
|
-
"license": "MIT",
|
|
128
|
-
"dependencies": {
|
|
129
|
-
"@vue/shared": "3.5.12"
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
"node_modules/@vue/runtime-core": {
|
|
133
|
-
"version": "3.5.12",
|
|
134
|
-
"resolved": "https://registry.npmjs.org/@vue/runtime-core/-/runtime-core-3.5.12.tgz",
|
|
135
|
-
"integrity": "sha512-hrMUYV6tpocr3TL3Ad8DqxOdpDe4zuQY4HPY3X/VRh+L2myQO8MFXPAMarIOSGNu0bFAjh1yBkMPXZBqCk62Uw==",
|
|
136
|
-
"license": "MIT",
|
|
137
|
-
"dependencies": {
|
|
138
|
-
"@vue/reactivity": "3.5.12",
|
|
139
|
-
"@vue/shared": "3.5.12"
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
"node_modules/@vue/runtime-dom": {
|
|
143
|
-
"version": "3.5.12",
|
|
144
|
-
"resolved": "https://registry.npmjs.org/@vue/runtime-dom/-/runtime-dom-3.5.12.tgz",
|
|
145
|
-
"integrity": "sha512-q8VFxR9A2MRfBr6/55Q3umyoN7ya836FzRXajPB6/Vvuv0zOPL+qltd9rIMzG/DbRLAIlREmnLsplEF/kotXKA==",
|
|
146
|
-
"license": "MIT",
|
|
147
|
-
"dependencies": {
|
|
148
|
-
"@vue/reactivity": "3.5.12",
|
|
149
|
-
"@vue/runtime-core": "3.5.12",
|
|
150
|
-
"@vue/shared": "3.5.12",
|
|
151
|
-
"csstype": "^3.1.3"
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
"node_modules/@vue/server-renderer": {
|
|
155
|
-
"version": "3.5.12",
|
|
156
|
-
"resolved": "https://registry.npmjs.org/@vue/server-renderer/-/server-renderer-3.5.12.tgz",
|
|
157
|
-
"integrity": "sha512-I3QoeDDeEPZm8yR28JtY+rk880Oqmj43hreIBVTicisFTx/Dl7JpG72g/X7YF8hnQD3IFhkky5i2bPonwrTVPg==",
|
|
158
|
-
"license": "MIT",
|
|
159
|
-
"dependencies": {
|
|
160
|
-
"@vue/compiler-ssr": "3.5.12",
|
|
161
|
-
"@vue/shared": "3.5.12"
|
|
162
|
-
},
|
|
163
|
-
"peerDependencies": {
|
|
164
|
-
"vue": "3.5.12"
|
|
165
|
-
}
|
|
166
|
-
},
|
|
167
|
-
"node_modules/@vue/shared": {
|
|
168
|
-
"version": "3.5.12",
|
|
169
|
-
"resolved": "https://registry.npmjs.org/@vue/shared/-/shared-3.5.12.tgz",
|
|
170
|
-
"integrity": "sha512-L2RPSAwUFbgZH20etwrXyVyCBu9OxRSi8T/38QsvnkJyvq2LufW2lDCOzm7t/U9C1mkhJGWYfCuFBCmIuNivrg==",
|
|
171
|
-
"license": "MIT"
|
|
172
|
-
},
|
|
173
|
-
"node_modules/csstype": {
|
|
174
|
-
"version": "3.1.3",
|
|
175
|
-
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
|
|
176
|
-
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
|
|
177
|
-
"license": "MIT"
|
|
178
|
-
},
|
|
179
|
-
"node_modules/entities": {
|
|
180
|
-
"version": "4.5.0",
|
|
181
|
-
"resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz",
|
|
182
|
-
"integrity": "sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==",
|
|
183
|
-
"license": "BSD-2-Clause",
|
|
184
|
-
"engines": {
|
|
185
|
-
"node": ">=0.12"
|
|
186
|
-
},
|
|
187
|
-
"funding": {
|
|
188
|
-
"url": "https://github.com/fb55/entities?sponsor=1"
|
|
189
|
-
}
|
|
190
|
-
},
|
|
191
|
-
"node_modules/estree-walker": {
|
|
192
|
-
"version": "2.0.2",
|
|
193
|
-
"resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz",
|
|
194
|
-
"integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==",
|
|
195
|
-
"license": "MIT"
|
|
196
|
-
},
|
|
197
|
-
"node_modules/magic-string": {
|
|
198
|
-
"version": "0.30.12",
|
|
199
|
-
"resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.12.tgz",
|
|
200
|
-
"integrity": "sha512-Ea8I3sQMVXr8JhN4z+H/d8zwo+tYDgHE9+5G4Wnrwhs0gaK9fXTKx0Tw5Xwsd/bCPTTZNRAdpyzvoeORe9LYpw==",
|
|
201
|
-
"license": "MIT",
|
|
202
|
-
"dependencies": {
|
|
203
|
-
"@jridgewell/sourcemap-codec": "^1.5.0"
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
"node_modules/nanoid": {
|
|
207
|
-
"version": "3.3.7",
|
|
208
|
-
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
|
|
209
|
-
"integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
|
|
210
|
-
"funding": [
|
|
211
|
-
{
|
|
212
|
-
"type": "github",
|
|
213
|
-
"url": "https://github.com/sponsors/ai"
|
|
214
|
-
}
|
|
215
|
-
],
|
|
216
|
-
"license": "MIT",
|
|
217
|
-
"bin": {
|
|
218
|
-
"nanoid": "bin/nanoid.cjs"
|
|
219
|
-
},
|
|
220
|
-
"engines": {
|
|
221
|
-
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
|
|
222
|
-
}
|
|
223
|
-
},
|
|
224
|
-
"node_modules/picocolors": {
|
|
225
|
-
"version": "1.1.1",
|
|
226
|
-
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
|
|
227
|
-
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
|
|
228
|
-
"license": "ISC"
|
|
229
|
-
},
|
|
230
|
-
"node_modules/postcss": {
|
|
231
|
-
"version": "8.4.47",
|
|
232
|
-
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.47.tgz",
|
|
233
|
-
"integrity": "sha512-56rxCq7G/XfB4EkXq9Egn5GCqugWvDFjafDOThIdMBsI15iqPqR5r15TfSr1YPYeEI19YeaXMCbY6u88Y76GLQ==",
|
|
234
|
-
"funding": [
|
|
235
|
-
{
|
|
236
|
-
"type": "opencollective",
|
|
237
|
-
"url": "https://opencollective.com/postcss/"
|
|
238
|
-
},
|
|
239
|
-
{
|
|
240
|
-
"type": "tidelift",
|
|
241
|
-
"url": "https://tidelift.com/funding/github/npm/postcss"
|
|
242
|
-
},
|
|
243
|
-
{
|
|
244
|
-
"type": "github",
|
|
245
|
-
"url": "https://github.com/sponsors/ai"
|
|
246
|
-
}
|
|
247
|
-
],
|
|
248
|
-
"license": "MIT",
|
|
249
|
-
"dependencies": {
|
|
250
|
-
"nanoid": "^3.3.7",
|
|
251
|
-
"picocolors": "^1.1.0",
|
|
252
|
-
"source-map-js": "^1.2.1"
|
|
253
|
-
},
|
|
254
|
-
"engines": {
|
|
255
|
-
"node": "^10 || ^12 || >=14"
|
|
256
|
-
}
|
|
257
|
-
},
|
|
258
|
-
"node_modules/source-map-js": {
|
|
259
|
-
"version": "1.2.1",
|
|
260
|
-
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
|
|
261
|
-
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
|
|
262
|
-
"license": "BSD-3-Clause",
|
|
263
|
-
"engines": {
|
|
264
|
-
"node": ">=0.10.0"
|
|
265
|
-
}
|
|
266
|
-
},
|
|
267
|
-
"node_modules/vue": {
|
|
268
|
-
"version": "3.5.12",
|
|
269
|
-
"resolved": "https://registry.npmjs.org/vue/-/vue-3.5.12.tgz",
|
|
270
|
-
"integrity": "sha512-CLVZtXtn2ItBIi/zHZ0Sg1Xkb7+PU32bJJ8Bmy7ts3jxXTcbfsEfBivFYYWz1Hur+lalqGAh65Coin0r+HRUfg==",
|
|
271
|
-
"license": "MIT",
|
|
272
|
-
"dependencies": {
|
|
273
|
-
"@vue/compiler-dom": "3.5.12",
|
|
274
|
-
"@vue/compiler-sfc": "3.5.12",
|
|
275
|
-
"@vue/runtime-dom": "3.5.12",
|
|
276
|
-
"@vue/server-renderer": "3.5.12",
|
|
277
|
-
"@vue/shared": "3.5.12"
|
|
278
|
-
},
|
|
279
|
-
"peerDependencies": {
|
|
280
|
-
"typescript": "*"
|
|
281
|
-
},
|
|
282
|
-
"peerDependenciesMeta": {
|
|
283
|
-
"typescript": {
|
|
284
|
-
"optional": true
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
},
|
|
288
|
-
"node_modules/vue3-otp-input": {
|
|
289
|
-
"version": "0.5.21",
|
|
290
|
-
"resolved": "https://registry.npmjs.org/vue3-otp-input/-/vue3-otp-input-0.5.21.tgz",
|
|
291
|
-
"integrity": "sha512-dRxmGJqXlU+U5dCijNCyY7ird49+pyfeQspSTqvIp2Xs+VByIluNlTOjgHrftzSdeVZggtx+Ojb8uKiRLaob4Q==",
|
|
292
|
-
"license": "MIT",
|
|
293
|
-
"dependencies": {
|
|
294
|
-
"vue": "^3.4.27"
|
|
295
|
-
},
|
|
296
|
-
"peerDependencies": {
|
|
297
|
-
"vue": "^3.0.*"
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
}
|
package/dist/custom/package.json
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "custom",
|
|
3
|
-
"version": "1.0.0",
|
|
4
|
-
"main": "index.js",
|
|
5
|
-
"scripts": {
|
|
6
|
-
"test": "echo \"Error: no test specified\" && exit 1"
|
|
7
|
-
},
|
|
8
|
-
"keywords": [],
|
|
9
|
-
"author": "",
|
|
10
|
-
"license": "ISC",
|
|
11
|
-
"description": "",
|
|
12
|
-
"dependencies": {
|
|
13
|
-
"@loltech/vue3-2fa-code-input": "^1.1.0",
|
|
14
|
-
"vue3-otp-input": "^0.5.21"
|
|
15
|
-
}
|
|
16
|
-
}
|