@adminforth/email-invite 1.0.3 → 1.0.5

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
@@ -7,5 +7,5 @@ custom/
7
7
  custom/SetPassword.vue
8
8
  custom/tsconfig.json
9
9
 
10
- sent 13,853 bytes received 58 bytes 27,822.00 bytes/sec
11
- total size is 13,638 speedup is 0.98
10
+ sent 13,819 bytes received 58 bytes 27,754.00 bytes/sec
11
+ total size is 13,604 speedup is 0.98
@@ -37,7 +37,7 @@
37
37
  <!-- Modal body -->
38
38
  <div class="p-4 md:p-5">
39
39
  <!-- Success message -->
40
- <div v-if="passwordSet" class="af-alert-success flex items-center justify-center p-4 mb-4 text-sm text-green-800 rounded-lg bg-green-50 dark:bg-green-800 dark:text-green-400" role="alert">
40
+ <div v-if="passwordSet" class="af-alert-success flex items-center justify-center p-4 mb-4 text-sm rounded-lg dark:text-white" role="alert">
41
41
  <div class="text-center">
42
42
  <p class="mb-3">{{$t('Password set successfully!')}}</p>
43
43
  <Link to="/login" class="inline-flex items-center px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500">
@@ -93,7 +93,7 @@
93
93
  </button>
94
94
  </div>
95
95
 
96
- <div v-if="validationError || error" class="flex items-center p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400" role="alert">
96
+ <div v-if="validationError || error" class="af-alert-error flex items-center p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400" role="alert">
97
97
  <svg class="flex-shrink-0 inline w-4 h-4 me-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
98
98
  <path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"/>
99
99
  </svg>
@@ -37,7 +37,7 @@
37
37
  <!-- Modal body -->
38
38
  <div class="p-4 md:p-5">
39
39
  <!-- Success message -->
40
- <div v-if="passwordSet" class="af-alert-success flex items-center justify-center p-4 mb-4 text-sm text-green-800 rounded-lg bg-green-50 dark:bg-green-800 dark:text-green-400" role="alert">
40
+ <div v-if="passwordSet" class="af-alert-success flex items-center justify-center p-4 mb-4 text-sm rounded-lg dark:text-white" role="alert">
41
41
  <div class="text-center">
42
42
  <p class="mb-3">{{$t('Password set successfully!')}}</p>
43
43
  <Link to="/login" class="inline-flex items-center px-4 py-2 text-sm font-medium text-white bg-blue-600 border border-transparent rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500">
@@ -93,7 +93,7 @@
93
93
  </button>
94
94
  </div>
95
95
 
96
- <div v-if="validationError || error" class="flex items-center p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400" role="alert">
96
+ <div v-if="validationError || error" class="af-alert-error flex items-center p-4 mb-4 text-sm text-red-800 rounded-lg bg-red-50 dark:bg-gray-800 dark:text-red-400" role="alert">
97
97
  <svg class="flex-shrink-0 inline w-4 h-4 me-3" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
98
98
  <path d="M10 .5a9.5 9.5 0 1 0 9.5 9.5A9.51 9.51 0 0 0 10 .5ZM9.5 4a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM12 15H8a1 1 0 0 1 0-2h1v-3H8a1 1 0 0 1 0-2h2a1 1 0 0 1 1 1v4h1a1 1 0 0 1 0 2Z"/>
99
99
  </svg>
package/dist/index.js CHANGED
@@ -212,6 +212,9 @@ export default class EmailInvitePlugin extends AdminForthPlugin {
212
212
  if (!userRecord) {
213
213
  return { error: 'User not found', ok: false };
214
214
  }
215
+ if (userRecord[this.options.emailConfirmedField]) {
216
+ return { error: 'Password already set. Invitation link cannot be reused.', ok: false };
217
+ }
215
218
  const userEmail = userRecord[this.options.emailField];
216
219
  const tokenEmail = email;
217
220
  if (!userEmail || userEmail.toLowerCase() !== tokenEmail.toLowerCase()) {
package/index.ts CHANGED
@@ -259,11 +259,13 @@ export default class EmailInvitePlugin extends AdminForthPlugin {
259
259
  );
260
260
  userRecord = records.length > 0 ? records[0] : null;
261
261
  }
262
-
263
262
  if (!userRecord) {
264
263
  return { error: 'User not found', ok: false };
265
264
  }
266
265
 
266
+ if ( userRecord[this.options.emailConfirmedField] ) {
267
+ return { error: 'Password already set. Invitation link cannot be reused.', ok: false };
268
+ }
267
269
  const userEmail = userRecord[this.options.emailField];
268
270
  const tokenEmail = email;
269
271
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adminforth/email-invite",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "type": "module",