@adminforth/two-factors-auth 2.10.7 → 2.10.8
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
|
@@ -15,5 +15,5 @@ custom/package.json
|
|
|
15
15
|
custom/tsconfig.json
|
|
16
16
|
custom/utils.js
|
|
17
17
|
|
|
18
|
-
sent 273,
|
|
19
|
-
total size is 272,
|
|
18
|
+
sent 273,574 bytes received 210 bytes 547,568.00 bytes/sec
|
|
19
|
+
total size is 272,747 speedup is 1.00
|
|
@@ -238,7 +238,7 @@
|
|
|
238
238
|
isFetchingPasskey.value = true;
|
|
239
239
|
let confirmationResult;
|
|
240
240
|
try {
|
|
241
|
-
confirmationResult = await window.adminforthTwoFaModal.get2FaConfirmationResult(
|
|
241
|
+
confirmationResult = await window.adminforthTwoFaModal.get2FaConfirmationResult("To add passkey first verify yourself");
|
|
242
242
|
} catch (e) {
|
|
243
243
|
isFetchingPasskey.value = false;
|
|
244
244
|
return;
|
|
@@ -238,7 +238,7 @@
|
|
|
238
238
|
isFetchingPasskey.value = true;
|
|
239
239
|
let confirmationResult;
|
|
240
240
|
try {
|
|
241
|
-
confirmationResult = await window.adminforthTwoFaModal.get2FaConfirmationResult(
|
|
241
|
+
confirmationResult = await window.adminforthTwoFaModal.get2FaConfirmationResult("To add passkey first verify yourself");
|
|
242
242
|
} catch (e) {
|
|
243
243
|
isFetchingPasskey.value = false;
|
|
244
244
|
return;
|
package/dist/index.js
CHANGED
|
@@ -104,9 +104,12 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
104
104
|
}
|
|
105
105
|
verify(confirmationResult, opts) {
|
|
106
106
|
return __awaiter(this, void 0, void 0, function* () {
|
|
107
|
-
var _a, _b, _c, _d, _e;
|
|
107
|
+
var _a, _b, _c, _d, _e, _f;
|
|
108
108
|
if (!confirmationResult)
|
|
109
109
|
return { error: "Confirmation result is required" };
|
|
110
|
+
if (!(opts === null || opts === void 0 ? void 0 : opts.cookies)) {
|
|
111
|
+
opts.cookies = (_a = opts.extra) === null || _a === void 0 ? void 0 : _a.cookies;
|
|
112
|
+
}
|
|
110
113
|
if (this.options.usersFilterToApply) {
|
|
111
114
|
const res = this.options.usersFilterToApply(opts.adminUser);
|
|
112
115
|
if (res === false) {
|
|
@@ -119,7 +122,7 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
119
122
|
return { ok: true };
|
|
120
123
|
}
|
|
121
124
|
}
|
|
122
|
-
if (this.options.stepUpMfaGracePeriodSeconds && ((
|
|
125
|
+
if (this.options.stepUpMfaGracePeriodSeconds && ((_b = opts.extra) === null || _b === void 0 ? void 0 : _b.headers) && !confirmationResult.mode) {
|
|
123
126
|
const verificationResult = yield this.isTempSkip2FAGraceValid(opts.extra.headers, opts.cookies);
|
|
124
127
|
if (verificationResult === true) {
|
|
125
128
|
return { ok: true };
|
|
@@ -132,10 +135,10 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
132
135
|
if (!authRes)
|
|
133
136
|
return { error: "Auth resource not found" };
|
|
134
137
|
const connector = this.adminforth.connectors[authRes.dataSource];
|
|
135
|
-
const pkName = (
|
|
138
|
+
const pkName = (_c = authRes.columns.find(c => c.primaryKey)) === null || _c === void 0 ? void 0 : _c.name;
|
|
136
139
|
if (!pkName)
|
|
137
140
|
return { error: "Primary key not found on auth resource" };
|
|
138
|
-
const pk = (
|
|
141
|
+
const pk = (_d = opts === null || opts === void 0 ? void 0 : opts.userPk) !== null && _d !== void 0 ? _d : (_f = (_e = opts === null || opts === void 0 ? void 0 : opts.adminUser) === null || _e === void 0 ? void 0 : _e.dbUser) === null || _f === void 0 ? void 0 : _f[pkName];
|
|
139
142
|
if (!pk)
|
|
140
143
|
return { error: "User PK is required" };
|
|
141
144
|
const user = yield connector.getRecordByPrimaryKey(authRes, pk);
|
package/index.ts
CHANGED
|
@@ -116,6 +116,9 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
|
|
|
116
116
|
opts?: { adminUser?: AdminUser; userPk?: string; cookies?: any, response?: IAdminForthHttpResponse, extra?: HttpExtra }
|
|
117
117
|
): Promise<{ ok: true } | { error: string }> {
|
|
118
118
|
if (!confirmationResult) return { error: "Confirmation result is required" };
|
|
119
|
+
if (!opts?.cookies) {
|
|
120
|
+
opts.cookies = opts.extra?.cookies;
|
|
121
|
+
}
|
|
119
122
|
if (this.options.usersFilterToApply) {
|
|
120
123
|
const res = this.options.usersFilterToApply(opts.adminUser);
|
|
121
124
|
if ( res === false ) {
|