@adminforth/two-factors-auth 1.2.1 → 1.2.2

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
13
+ sent 26,210 bytes received 115 bytes 52,650.00 bytes/sec
14
14
  total size is 25,787 speedup is 0.98
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.2.2",
4
4
  "description": "AdminForth plugin for two factors authentication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",