@adminforth/two-factors-auth 3.1.4 → 3.1.5

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/dist/index.js CHANGED
@@ -1030,15 +1030,15 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
1030
1030
  return { ok: false, error: message };
1031
1031
  };
1032
1032
  if (!(sessionsIds) || !confirmationResult) {
1033
- resolveAllIdsAsFailed('Confirmation window was closed or did not return required data');
1033
+ return (resolveAllIdsAsFailed('Confirmation window was closed or did not return required data'));
1034
1034
  }
1035
1035
  for (const id of idsToResolve) {
1036
1036
  const validationResult = yield this.adminforth.auth.verify(id, 'auto2FA', false);
1037
1037
  if (!validationResult) {
1038
- resolveAllIdsAsFailed('Invalid session ID or confirmation result');
1038
+ return (resolveAllIdsAsFailed('Invalid session ID or confirmation result'));
1039
1039
  }
1040
1040
  if (validationResult.adminUserPk !== adminUser.pk) {
1041
- resolveAllIdsAsFailed('Session does not belong to the authenticated user');
1041
+ return (resolveAllIdsAsFailed('Session does not belong to the authenticated user'));
1042
1042
  }
1043
1043
  }
1044
1044
  const verificationResult = yield this.verify(confirmationResult, {
@@ -1051,12 +1051,14 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
1051
1051
  }
1052
1052
  });
1053
1053
  if (!verificationResult || !('ok' in verificationResult)) {
1054
- resolveAllIdsAsFailed('Verification failed');
1054
+ return (resolveAllIdsAsFailed('Verification failed'));
1055
1055
  }
1056
- for (const id of idsToResolve) {
1057
- this.resolveResponse(id, { ok: true, passkeyConfirmed: verificationResult });
1056
+ if ('ok' in verificationResult && verificationResult.ok) {
1057
+ for (const id of idsToResolve) {
1058
+ this.resolveResponse(id, { ok: true, passkeyConfirmed: verificationResult });
1059
+ }
1060
+ return { ok: true };
1058
1061
  }
1059
- return { ok: true };
1060
1062
  })
1061
1063
  });
1062
1064
  }
package/index.ts CHANGED
@@ -1093,16 +1093,16 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
1093
1093
  }
1094
1094
 
1095
1095
  if (!(sessionsIds) || !confirmationResult) {
1096
- resolveAllIdsAsFailed('Confirmation window was closed or did not return required data');
1096
+ return(resolveAllIdsAsFailed('Confirmation window was closed or did not return required data'));
1097
1097
  }
1098
1098
 
1099
1099
  for (const id of idsToResolve) {
1100
1100
  const validationResult = await this.adminforth.auth.verify(id, 'auto2FA', false);
1101
1101
  if (!validationResult) {
1102
- resolveAllIdsAsFailed('Invalid session ID or confirmation result');
1102
+ return(resolveAllIdsAsFailed('Invalid session ID or confirmation result'));
1103
1103
  }
1104
1104
  if (validationResult.adminUserPk !== adminUser.pk) {
1105
- resolveAllIdsAsFailed('Session does not belong to the authenticated user');
1105
+ return(resolveAllIdsAsFailed('Session does not belong to the authenticated user'));
1106
1106
  }
1107
1107
  }
1108
1108
 
@@ -1116,13 +1116,14 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
1116
1116
  } as HttpExtra
1117
1117
  });
1118
1118
  if ( !verificationResult || !('ok' in verificationResult) ) {
1119
- resolveAllIdsAsFailed('Verification failed');
1119
+ return(resolveAllIdsAsFailed('Verification failed'));
1120
1120
  }
1121
-
1122
- for (const id of idsToResolve) {
1123
- this.resolveResponse(id, { ok: true, passkeyConfirmed: verificationResult });
1121
+ if ('ok' in verificationResult && verificationResult.ok){
1122
+ for (const id of idsToResolve) {
1123
+ this.resolveResponse(id, { ok: true, passkeyConfirmed: verificationResult });
1124
+ }
1125
+ return { ok: true };
1124
1126
  }
1125
- return { ok: true };
1126
1127
  }
1127
1128
  });
1128
1129
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/two-factors-auth",
3
- "version": "3.1.4",
3
+ "version": "3.1.5",
4
4
  "description": "AdminForth plugin for two factors authentication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",