@adminforth/two-factors-auth 2.1.3 → 2.1.4

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 76,042 bytes received 172 bytes 152,428.00 bytes/sec
17
- total size is 75,402 speedup is 0.99
16
+ sent 77,390 bytes received 172 bytes 155,124.00 bytes/sec
17
+ total size is 76,750 speedup is 0.99
@@ -377,14 +377,19 @@
377
377
  if (name === 'AbortError') {
378
378
  // Aborted intentionally; no user-facing error needed
379
379
  return null;
380
- }
381
- if (name === 'InvalidStateError' || name === 'OperationError' || /pending/i.test(message)) {
380
+ } else if (name === 'InvalidStateError' || name === 'OperationError' || /pending/i.test(message)) {
382
381
  adminforth.alert({ message: t('Another security prompt is already open. Please try again.'), variant: 'warning' });
383
382
  codeError.value = t('A previous passkey attempt was still pending. Please try again.');
384
383
  return null;
384
+ } else if (name === 'NotAllowedError') {
385
+ adminforth.alert({ message: `The operation either timed out or was not allowed`, variant: 'warning' });
386
+ codeError.value = 'The operation either timed out or was not allowed.';
387
+ return null;
388
+ } else {
389
+ adminforth.alert({message: `Error during authentication: ${error}`, variant: 'warning'});
390
+ codeError.value = 'Error during authentication.';
391
+ return null;
385
392
  }
386
- adminforth.alert({message: `Error during authentication: ${error}`, variant: 'warning'});
387
- codeError.value = 'Error during authentication.';
388
393
  }
389
394
  finally {
390
395
  // Clear in-flight state regardless of outcome
package/custom/utils.js CHANGED
@@ -100,7 +100,25 @@
100
100
  });
101
101
  return credential;
102
102
  } catch (error) {
103
- adminforth.alert({message: 'Error during authentication', variant: 'warning'});
104
- codeError.value = 'Error during authentication.';
103
+ console.error('Error during authentication:', error);
104
+ // Handle specific concurrent/pending request error cases gracefully
105
+ const name = (error && (error.name || error.constructor?.name)) || '';
106
+ const message = (error && error.message) || '';
107
+ if (name === 'AbortError') {
108
+ // Aborted intentionally; no user-facing error needed
109
+ return null;
110
+ } else if (name === 'InvalidStateError' || name === 'OperationError' || /pending/i.test(message)) {
111
+ adminforth.alert({ message: t('Another security prompt is already open. Please try again.'), variant: 'warning' });
112
+ codeError.value = t('A previous passkey attempt was still pending. Please try again.');
113
+ return null;
114
+ } else if (name === 'NotAllowedError') {
115
+ adminforth.alert({ message: `The operation either timed out or was not allowed`, variant: 'warning' });
116
+ codeError.value = 'The operation either timed out or was not allowed.';
117
+ return null;
118
+ } else {
119
+ adminforth.alert({message: `Error during authentication: ${error}`, variant: 'warning'});
120
+ codeError.value = 'Error during authentication.';
121
+ return null;
122
+ }
105
123
  }
106
124
  }
@@ -377,14 +377,19 @@
377
377
  if (name === 'AbortError') {
378
378
  // Aborted intentionally; no user-facing error needed
379
379
  return null;
380
- }
381
- if (name === 'InvalidStateError' || name === 'OperationError' || /pending/i.test(message)) {
380
+ } else if (name === 'InvalidStateError' || name === 'OperationError' || /pending/i.test(message)) {
382
381
  adminforth.alert({ message: t('Another security prompt is already open. Please try again.'), variant: 'warning' });
383
382
  codeError.value = t('A previous passkey attempt was still pending. Please try again.');
384
383
  return null;
384
+ } else if (name === 'NotAllowedError') {
385
+ adminforth.alert({ message: `The operation either timed out or was not allowed`, variant: 'warning' });
386
+ codeError.value = 'The operation either timed out or was not allowed.';
387
+ return null;
388
+ } else {
389
+ adminforth.alert({message: `Error during authentication: ${error}`, variant: 'warning'});
390
+ codeError.value = 'Error during authentication.';
391
+ return null;
385
392
  }
386
- adminforth.alert({message: `Error during authentication: ${error}`, variant: 'warning'});
387
- codeError.value = 'Error during authentication.';
388
393
  }
389
394
  finally {
390
395
  // Clear in-flight state regardless of outcome
@@ -100,7 +100,25 @@
100
100
  });
101
101
  return credential;
102
102
  } catch (error) {
103
- adminforth.alert({message: 'Error during authentication', variant: 'warning'});
104
- codeError.value = 'Error during authentication.';
103
+ console.error('Error during authentication:', error);
104
+ // Handle specific concurrent/pending request error cases gracefully
105
+ const name = (error && (error.name || error.constructor?.name)) || '';
106
+ const message = (error && error.message) || '';
107
+ if (name === 'AbortError') {
108
+ // Aborted intentionally; no user-facing error needed
109
+ return null;
110
+ } else if (name === 'InvalidStateError' || name === 'OperationError' || /pending/i.test(message)) {
111
+ adminforth.alert({ message: t('Another security prompt is already open. Please try again.'), variant: 'warning' });
112
+ codeError.value = t('A previous passkey attempt was still pending. Please try again.');
113
+ return null;
114
+ } else if (name === 'NotAllowedError') {
115
+ adminforth.alert({ message: `The operation either timed out or was not allowed`, variant: 'warning' });
116
+ codeError.value = 'The operation either timed out or was not allowed.';
117
+ return null;
118
+ } else {
119
+ adminforth.alert({message: `Error during authentication: ${error}`, variant: 'warning'});
120
+ codeError.value = 'Error during authentication.';
121
+ return null;
122
+ }
105
123
  }
106
124
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/two-factors-auth",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "AdminForth plugin for two factors authentication",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",