@adminforth/two-factors-auth 1.2.1 → 1.3.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/build.log CHANGED
@@ -10,5 +10,5 @@ custom/package-lock.json
10
10
  custom/package.json
11
11
  custom/tsconfig.json
12
12
 
13
- sent 26,216 bytes received 115 bytes 52,662.00 bytes/sec
14
- total size is 25,787 speedup is 0.98
13
+ sent 26,257 bytes received 115 bytes 52,744.00 bytes/sec
14
+ total size is 25,834 speedup is 0.98
@@ -8,7 +8,7 @@
8
8
  }: {}"
9
9
  >
10
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">
11
+ <div 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
14
  <div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" >
@@ -8,7 +8,7 @@
8
8
  }: {}"
9
9
  >
10
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">
11
+ <div id="authentication-modal" tabindex="-1" class="af-two-factors-setup 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
14
  <div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" >
@@ -8,7 +8,7 @@
8
8
  }: {}"
9
9
  >
10
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">
11
+ <div 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
14
  <div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" >
@@ -8,7 +8,7 @@
8
8
  }: {}"
9
9
  >
10
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">
11
+ <div id="authentication-modal" tabindex="-1" class="af-two-factors-setup 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
14
  <div class="relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" >
package/dist/index.js CHANGED
@@ -47,7 +47,9 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
47
47
  if (!this.authResource.columns.some((col) => col.name === this.options.twoFaSecretFieldName)) {
48
48
  throw new Error(`Column ${this.options.twoFaSecretFieldName} not found in ${this.authResource.label}`);
49
49
  }
50
- this.adminforth.config.auth.beforeLoginConfirmation.push((_a) => __awaiter(this, [_a], void 0, function* ({ adminUser, response }) {
50
+ const beforeLoginConfirmation = this.adminforth.config.auth.beforeLoginConfirmation;
51
+ const beforeLoginConfirmationArray = Array.isArray(beforeLoginConfirmation) ? beforeLoginConfirmation : [beforeLoginConfirmation];
52
+ beforeLoginConfirmationArray.push((_a) => __awaiter(this, [_a], void 0, function* ({ adminUser, response }) {
51
53
  const secret = adminUser.dbUser[this.options.twoFaSecretFieldName];
52
54
  const userName = adminUser.dbUser[adminforth.config.auth.usernameField];
53
55
  const brandName = adminforth.config.customization.brandName;
package/index.ts CHANGED
@@ -54,7 +54,10 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
54
54
  if(!this.authResource.columns.some((col)=>col.name === this.options.twoFaSecretFieldName)){
55
55
  throw new Error(`Column ${this.options.twoFaSecretFieldName} not found in ${this.authResource.label}`)
56
56
  }
57
- (this.adminforth.config.auth.beforeLoginConfirmation as BeforeLoginConfirmationFunction[]).push(
57
+
58
+ const beforeLoginConfirmation = this.adminforth.config.auth.beforeLoginConfirmation;
59
+ const beforeLoginConfirmationArray = Array.isArray(beforeLoginConfirmation) ? beforeLoginConfirmation : [beforeLoginConfirmation];
60
+ beforeLoginConfirmationArray.push(
58
61
  async({ adminUser, response }: { adminUser: AdminUser, response: IAdminForthHttpResponse} )=> {
59
62
  const secret = adminUser.dbUser[this.options.twoFaSecretFieldName]
60
63
  const userName = adminUser.dbUser[adminforth.config.auth.usernameField]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/two-factors-auth",
3
- "version": "1.2.1",
3
+ "version": "1.3.0",
4
4
  "description": "AdminForth plugin for two factors authentication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",