@adminforth/two-factors-auth 2.6.1 → 2.6.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
@@ -15,5 +15,5 @@ custom/package.json
15
15
  custom/tsconfig.json
16
16
  custom/utils.js
17
17
 
18
- sent 272,430 bytes received 210 bytes 545,280.00 bytes/sec
19
- total size is 271,603 speedup is 1.00
18
+ sent 272,490 bytes received 210 bytes 545,400.00 bytes/sec
19
+ total size is 271,663 speedup is 1.00
@@ -279,6 +279,9 @@
279
279
  }
280
280
 
281
281
  async function checkIfUserHasPasskeys() {
282
+ if(!route.meta.isPasskeysEnabled) {
283
+ return;
284
+ }
282
285
  try {
283
286
  await callAdminForthApi({
284
287
  method: 'POST',
@@ -279,6 +279,9 @@
279
279
  }
280
280
 
281
281
  async function checkIfUserHasPasskeys() {
282
+ if(!route.meta.isPasskeysEnabled) {
283
+ return;
284
+ }
282
285
  try {
283
286
  await callAdminForthApi({
284
287
  method: 'POST',
package/dist/index.js CHANGED
@@ -780,6 +780,9 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
780
780
  path: `/plugin/passkeys/checkIfUserHasPasskeys`,
781
781
  noAuth: true,
782
782
  handler: (_a) => __awaiter(this, [_a], void 0, function* ({ cookies }) {
783
+ if (!this.options.passkeys) {
784
+ return { ok: false, hasPasskeys: false };
785
+ }
783
786
  const totpTemporaryJWT = this.adminforth.auth.getCustomCookie({ cookies: cookies, name: "2FaTemporaryJWT" });
784
787
  const decoded = yield this.adminforth.auth.verify(totpTemporaryJWT, 'temp2FA');
785
788
  if (!decoded)
package/index.ts CHANGED
@@ -834,6 +834,9 @@ export default class TwoFactorsAuthPlugin extends AdminForthPlugin {
834
834
  path: `/plugin/passkeys/checkIfUserHasPasskeys`,
835
835
  noAuth: true,
836
836
  handler: async ({ cookies }) => {
837
+ if (!this.options.passkeys) {
838
+ return { ok: false, hasPasskeys: false };
839
+ }
837
840
  const totpTemporaryJWT = this.adminforth.auth.getCustomCookie({cookies: cookies, name: "2FaTemporaryJWT"});
838
841
  const decoded = await this.adminforth.auth.verify(totpTemporaryJWT, 'temp2FA');
839
842
  if (!decoded)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/two-factors-auth",
3
- "version": "2.6.1",
3
+ "version": "2.6.2",
4
4
  "description": "AdminForth plugin for two factors authentication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",