@adminforth/two-factors-auth 3.1.4 → 3.2.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 +2 -2
- package/custom/TwoFAModal.vue +74 -49
- package/custom/TwoFactorsPasskeysSettings.vue +237 -333
- package/dist/custom/TwoFAModal.vue +74 -49
- package/dist/custom/TwoFactorsPasskeysSettings.vue +237 -333
- package/dist/index.js +10 -8
- package/index.ts +11 -10
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -732,7 +732,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
732
732
|
}
|
|
733
733
|
});
|
|
734
734
|
if (!verificationResult || !('ok' in verificationResult)) {
|
|
735
|
-
return { ok: false, error: 'Verification failed' };
|
|
735
|
+
return { ok: false, error: 'error' in verificationResult ? verificationResult.error : 'Verification failed' };
|
|
736
736
|
}
|
|
737
737
|
const settingsOrigin = (_b = this.options.passkeys) === null || _b === void 0 ? void 0 : _b.settings.expectedOrigin;
|
|
738
738
|
const rp = {
|
|
@@ -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
|
-
|
|
1057
|
-
|
|
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
|
@@ -791,8 +791,8 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
791
791
|
headers,
|
|
792
792
|
} as HttpExtra
|
|
793
793
|
});
|
|
794
|
-
if (
|
|
795
|
-
return { ok: false, error: 'Verification failed' };
|
|
794
|
+
if (!verificationResult || !('ok' in verificationResult)) {
|
|
795
|
+
return { ok: false, error: 'error' in verificationResult ? verificationResult.error : 'Verification failed' };
|
|
796
796
|
}
|
|
797
797
|
|
|
798
798
|
const settingsOrigin = this.options.passkeys?.settings.expectedOrigin;
|
|
@@ -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
|
-
|
|
1123
|
-
|
|
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
|
}
|