@adminforth/two-factors-auth 1.11.2 → 2.0.1

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
@@ -13,5 +13,5 @@ custom/package.json
13
13
  custom/tsconfig.json
14
14
  custom/utils.js
15
15
 
16
- sent 68,411 bytes received 172 bytes 137,166.00 bytes/sec
17
- total size is 67,771 speedup is 0.99
16
+ sent 68,570 bytes received 172 bytes 137,484.00 bytes/sec
17
+ total size is 67,930 speedup is 0.99
@@ -143,7 +143,7 @@
143
143
  await isCMAAvailable();
144
144
  tagOtpInputs();
145
145
  if (isPasskeysSupported.value === true) {
146
- checkIfUserHasPasskeys();
146
+ await checkIfUserHasPasskeys();
147
147
  }
148
148
  document.addEventListener('focusin', handleGlobalFocusIn, true);
149
149
  focusFirstAvailableOtpInput();
@@ -219,21 +219,25 @@
219
219
  }
220
220
  }
221
221
 
222
- function checkIfUserHasPasskeys() {
223
- callAdminForthApi({
224
- method: 'POST',
225
- path: '/plugin/passkeys/checkIfUserHasPasskeys',
226
- }).then((response) => {
227
- if (response.ok) {
228
- doesUserHavePasskeys.value = response.hasPasskeys;
229
- if ( doesUserHavePasskeys.value === true ) {
230
- router.push({ hash: '#passkey' })
231
- confirmationMode.value = 'passkey';
232
- } else {
233
- router.push({ hash: '#code' })
222
+ async function checkIfUserHasPasskeys() {
223
+ try {
224
+ await callAdminForthApi({
225
+ method: 'POST',
226
+ path: '/plugin/passkeys/checkIfUserHasPasskeys',
227
+ }).then(async (response) => {
228
+ if (response.ok) {
229
+ doesUserHavePasskeys.value = response.hasPasskeys;
230
+ if ( doesUserHavePasskeys.value === true ) {
231
+ router.push({ hash: '#passkey' })
232
+ confirmationMode.value = 'passkey';
233
+ } else {
234
+ router.push({ hash: '#code' })
235
+ }
234
236
  }
235
- }
236
- });
237
+ });
238
+ } catch (error) {
239
+ console.error('Error checking if user has passkeys:', error);
240
+ }
237
241
  }
238
242
 
239
243
  async function usePasskeyButton() {
@@ -165,7 +165,7 @@
165
165
  </div>
166
166
  </template>
167
167
 
168
- <script setup lang="ts">
168
+ <script setup lang="ts">
169
169
  import { Table } from '@/afcl'
170
170
  import { callAdminForthApi } from '@/utils';
171
171
  import adminforth from '@/adminforth';
@@ -143,7 +143,7 @@
143
143
  await isCMAAvailable();
144
144
  tagOtpInputs();
145
145
  if (isPasskeysSupported.value === true) {
146
- checkIfUserHasPasskeys();
146
+ await checkIfUserHasPasskeys();
147
147
  }
148
148
  document.addEventListener('focusin', handleGlobalFocusIn, true);
149
149
  focusFirstAvailableOtpInput();
@@ -219,21 +219,25 @@
219
219
  }
220
220
  }
221
221
 
222
- function checkIfUserHasPasskeys() {
223
- callAdminForthApi({
224
- method: 'POST',
225
- path: '/plugin/passkeys/checkIfUserHasPasskeys',
226
- }).then((response) => {
227
- if (response.ok) {
228
- doesUserHavePasskeys.value = response.hasPasskeys;
229
- if ( doesUserHavePasskeys.value === true ) {
230
- router.push({ hash: '#passkey' })
231
- confirmationMode.value = 'passkey';
232
- } else {
233
- router.push({ hash: '#code' })
222
+ async function checkIfUserHasPasskeys() {
223
+ try {
224
+ await callAdminForthApi({
225
+ method: 'POST',
226
+ path: '/plugin/passkeys/checkIfUserHasPasskeys',
227
+ }).then(async (response) => {
228
+ if (response.ok) {
229
+ doesUserHavePasskeys.value = response.hasPasskeys;
230
+ if ( doesUserHavePasskeys.value === true ) {
231
+ router.push({ hash: '#passkey' })
232
+ confirmationMode.value = 'passkey';
233
+ } else {
234
+ router.push({ hash: '#code' })
235
+ }
234
236
  }
235
- }
236
- });
237
+ });
238
+ } catch (error) {
239
+ console.error('Error checking if user has passkeys:', error);
240
+ }
237
241
  }
238
242
 
239
243
  async function usePasskeyButton() {
@@ -165,7 +165,7 @@
165
165
  </div>
166
166
  </template>
167
167
 
168
- <script setup lang="ts">
168
+ <script setup lang="ts">
169
169
  import { Table } from '@/afcl'
170
170
  import { callAdminForthApi } from '@/utils';
171
171
  import adminforth from '@/adminforth';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/two-factors-auth",
3
- "version": "1.11.2",
3
+ "version": "2.0.1",
4
4
  "description": "AdminForth plugin for two factors authentication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",