@adminforth/two-factors-auth 2.6.0 → 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,097 bytes received 210 bytes 544,614.00 bytes/sec
19
- total size is 271,270 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',
@@ -11,7 +11,7 @@
11
11
  <div id="authentication-modal" tabindex="-1" class="af-two-factors-setup overflow-y-auto overflow-x-hidden z-50 min-w-[00px] justify-center items-center md:inset-0 h-[calc(100%-1rem)] max-h-full">
12
12
  <div class="relative p-4 w-full max-w-md max-h-full">
13
13
  <!-- Modal content -->
14
- <div class="af-login-popup relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" >
14
+ <div class="af-login-popup relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" :class="codeError ? 'rounded-b-none' : ''">
15
15
  <div class="p-10 w-full max-w-md max-h-full custom-auth-wrapper" >
16
16
  <div>{{$t('Scan this QR code with your authenticator app or open by')}} <a class="text-blue-600" :href="totpUri">{{$t('click')}}</a></div>
17
17
  <div class="flex justify-center m-3" >
@@ -45,7 +45,6 @@
45
45
  @on-complete="handleOnComplete"
46
46
  />
47
47
  </div>
48
- <ErrorMessage :error="codeError" />
49
48
  <!-- <Vue2FACodeInput v-model="code" autofocus /> -->
50
49
  <div class="flex flex-row gap-2.5 h-12">
51
50
  <LinkButton to="/login" class="w-full">
@@ -57,6 +56,15 @@
57
56
  </div>
58
57
  </div>
59
58
  </div>
59
+ <div
60
+ v-if="codeError"
61
+ class="af-two-factors-confirmation-error relative top-full left-0 bg-red-100 text-red-700 text-sm px-2 py-2 rounded-b-lg shadow"
62
+ >
63
+ <p class="pl-6">{{ codeError }} </p>
64
+ </div>
65
+ <div v-else class="h-[36px] opacity-0">
66
+
67
+ </div>
60
68
  </div>
61
69
  </div>
62
70
  </div>
@@ -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',
@@ -11,7 +11,7 @@
11
11
  <div id="authentication-modal" tabindex="-1" class="af-two-factors-setup overflow-y-auto overflow-x-hidden z-50 min-w-[00px] justify-center items-center md:inset-0 h-[calc(100%-1rem)] max-h-full">
12
12
  <div class="relative p-4 w-full max-w-md max-h-full">
13
13
  <!-- Modal content -->
14
- <div class="af-login-popup relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" >
14
+ <div class="af-login-popup relative bg-white rounded-lg shadow dark:bg-gray-700 dark:shadow-black text-gray-500" :class="codeError ? 'rounded-b-none' : ''">
15
15
  <div class="p-10 w-full max-w-md max-h-full custom-auth-wrapper" >
16
16
  <div>{{$t('Scan this QR code with your authenticator app or open by')}} <a class="text-blue-600" :href="totpUri">{{$t('click')}}</a></div>
17
17
  <div class="flex justify-center m-3" >
@@ -45,7 +45,6 @@
45
45
  @on-complete="handleOnComplete"
46
46
  />
47
47
  </div>
48
- <ErrorMessage :error="codeError" />
49
48
  <!-- <Vue2FACodeInput v-model="code" autofocus /> -->
50
49
  <div class="flex flex-row gap-2.5 h-12">
51
50
  <LinkButton to="/login" class="w-full">
@@ -57,6 +56,15 @@
57
56
  </div>
58
57
  </div>
59
58
  </div>
59
+ <div
60
+ v-if="codeError"
61
+ class="af-two-factors-confirmation-error relative top-full left-0 bg-red-100 text-red-700 text-sm px-2 py-2 rounded-b-lg shadow"
62
+ >
63
+ <p class="pl-6">{{ codeError }} </p>
64
+ </div>
65
+ <div v-else class="h-[36px] opacity-0">
66
+
67
+ </div>
60
68
  </div>
61
69
  </div>
62
70
  </div>
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.0",
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",