@adminforth/two-factors-auth 1.0.5 → 1.0.7
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.
|
@@ -9,7 +9,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
import AdminForthPlugin from "../base.js";
|
|
11
11
|
import twofactor from 'node-2fa';
|
|
12
|
-
import AdminForthAuth from "../../auth.js";
|
|
13
12
|
export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
14
13
|
constructor(options) {
|
|
15
14
|
super(options, import.meta.url);
|
|
@@ -18,7 +17,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
18
17
|
modifyResourceConfig(adminforth, resourceConfig) {
|
|
19
18
|
super.modifyResourceConfig(adminforth, resourceConfig);
|
|
20
19
|
this.adminforth = adminforth;
|
|
21
|
-
this.adminForthAuth =
|
|
20
|
+
this.adminForthAuth = adminforth.auth;
|
|
22
21
|
const customPages = this.adminforth.config.customization.customPages;
|
|
23
22
|
customPages.push({
|
|
24
23
|
path: '/confirm2fa',
|
package/index.ts
CHANGED
|
@@ -1,26 +1,25 @@
|
|
|
1
|
-
import { AdminForthResource, AdminForthResourcePages,
|
|
1
|
+
import { AdminForthResource, AdminForthResourcePages, IAdminForth, IHttpServer, IAdminForthAuth } from "../../types/AdminForthConfig.js";
|
|
2
2
|
import AdminForthPlugin from "../base.js";
|
|
3
3
|
import twofactor from 'node-2fa';
|
|
4
|
-
import AdminForthAuth from "../../auth.js";
|
|
5
4
|
import { PluginOptions } from "./types.js"
|
|
6
5
|
|
|
7
6
|
|
|
8
7
|
export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
9
8
|
options: PluginOptions;
|
|
10
|
-
adminforth:
|
|
9
|
+
adminforth: IAdminForth;
|
|
11
10
|
authResource: AdminForthResource;
|
|
12
11
|
connectors: any;
|
|
13
|
-
adminForthAuth:
|
|
12
|
+
adminForthAuth: IAdminForthAuth;
|
|
14
13
|
|
|
15
14
|
constructor(options: PluginOptions) {
|
|
16
15
|
super(options, import.meta.url);
|
|
17
16
|
this.options = options;
|
|
18
17
|
}
|
|
19
18
|
|
|
20
|
-
modifyResourceConfig(adminforth:
|
|
19
|
+
modifyResourceConfig(adminforth: IAdminForth, resourceConfig: AdminForthResource) {
|
|
21
20
|
super.modifyResourceConfig(adminforth, resourceConfig);
|
|
22
21
|
this.adminforth = adminforth;
|
|
23
|
-
this.adminForthAuth =
|
|
22
|
+
this.adminForthAuth = adminforth.auth;
|
|
24
23
|
const customPages = this.adminforth.config.customization.customPages
|
|
25
24
|
customPages.push({
|
|
26
25
|
path:'/confirm2fa',
|
|
@@ -33,7 +32,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
33
32
|
this.activate( resourceConfig,adminforth )
|
|
34
33
|
}
|
|
35
34
|
|
|
36
|
-
activate ( resourceConfig: AdminForthResource, adminforth:
|
|
35
|
+
activate ( resourceConfig: AdminForthResource, adminforth: IAdminForth ){
|
|
37
36
|
if (!this.options.twoFaSecretFieldName){
|
|
38
37
|
throw new Error('twoFaSecretFieldName is required')
|
|
39
38
|
}
|
|
@@ -94,7 +93,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
94
93
|
})
|
|
95
94
|
}
|
|
96
95
|
|
|
97
|
-
setupEndpoints(server:
|
|
96
|
+
setupEndpoints(server: IHttpServer): void {
|
|
98
97
|
server.endpoint({
|
|
99
98
|
method: 'POST',
|
|
100
99
|
path: `/plugin/twofa/initSetup`,
|