nuxt-users 1.17.3 → 1.22.0

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.
Files changed (54) hide show
  1. package/CHANGELOG.md +161 -0
  2. package/dist/module.d.mts +1 -1
  3. package/dist/module.d.ts +1 -1
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +2 -1
  6. package/dist/runtime/components/NUsersList.vue.d.ts +7 -14
  7. package/dist/runtime/components/NUsersLoginForm.vue +2 -2
  8. package/dist/runtime/components/NUsersLoginForm.vue.d.ts +7 -3
  9. package/dist/runtime/components/NUsersPasswordStrengthIndicator.vue +2 -2
  10. package/dist/runtime/components/NUsersPasswordStrengthIndicator.vue.d.ts +1 -1
  11. package/dist/runtime/components/NUsersResetPasswordForm.vue +82 -11
  12. package/dist/runtime/components/NUsersResetPasswordForm.vue.d.ts +7 -3
  13. package/dist/runtime/components/NUsersUserCard.vue +1 -1
  14. package/dist/runtime/components/NUsersUserCard.vue.d.ts +4 -2
  15. package/dist/runtime/components/NUsersUserForm.vue +1 -1
  16. package/dist/runtime/components/NUsersUserForm.vue.d.ts +7 -7
  17. package/dist/runtime/composables/useAuthentication.d.ts +3 -21
  18. package/dist/runtime/composables/usePasswordValidation.d.ts +1 -1
  19. package/dist/runtime/composables/usePasswordValidation.js +1 -1
  20. package/dist/runtime/constants.js +1 -1
  21. package/dist/runtime/server/api/nuxt-users/[id].get.d.ts +1 -1
  22. package/dist/runtime/server/api/nuxt-users/[id].patch.d.ts +1 -1
  23. package/dist/runtime/server/api/nuxt-users/index.post.d.ts +1 -1
  24. package/dist/runtime/server/api/nuxt-users/me.get.d.ts +1 -1
  25. package/dist/runtime/server/api/nuxt-users/me.patch.d.ts +1 -1
  26. package/dist/runtime/server/api/nuxt-users/password/forgot.post.js +5 -2
  27. package/dist/runtime/server/api/nuxt-users/password/index.patch.js +2 -2
  28. package/dist/runtime/server/api/nuxt-users/password/reset.post.js +1 -1
  29. package/dist/runtime/server/api/nuxt-users/session/index.delete.js +1 -1
  30. package/dist/runtime/server/api/nuxt-users/session/index.post.d.ts +1 -10
  31. package/dist/runtime/server/api/nuxt-users/session/index.post.js +1 -1
  32. package/dist/runtime/server/composables/useNuxtUsersDatabase.d.ts +3 -11
  33. package/dist/runtime/server/composables/useServerAuth.d.ts +1 -1
  34. package/dist/runtime/server/middleware/authorization.server.js +5 -1
  35. package/dist/runtime/server/services/password.d.ts +2 -2
  36. package/dist/runtime/server/services/password.js +3 -2
  37. package/dist/runtime/server/utils/add-active-to-users.d.ts +1 -1
  38. package/dist/runtime/server/utils/create-migrations-table.d.ts +1 -1
  39. package/dist/runtime/server/utils/create-password-reset-tokens-table.d.ts +1 -1
  40. package/dist/runtime/server/utils/create-personal-access-tokens-table.d.ts +1 -1
  41. package/dist/runtime/server/utils/create-users-table.d.ts +1 -1
  42. package/dist/runtime/server/utils/db.d.ts +4 -2
  43. package/dist/runtime/server/utils/db.js +16 -1
  44. package/dist/runtime/server/utils/migrate.d.ts +1 -1
  45. package/dist/runtime/server/utils/user.d.ts +1 -1
  46. package/dist/runtime/server/utils/user.js +1 -1
  47. package/dist/runtime/utils/imports.d.ts +2 -0
  48. package/dist/runtime/utils/imports.js +2 -0
  49. package/dist/runtime/utils/permissions.d.ts +1 -1
  50. package/dist/shared/{nuxt-users.B8X7pDsj.d.mts → nuxt-users.CqP-FK1T.d.mts} +8 -6
  51. package/dist/shared/{nuxt-users.B8X7pDsj.d.ts → nuxt-users.CqP-FK1T.d.ts} +8 -6
  52. package/dist/utils.d.mts +1 -1
  53. package/dist/utils.d.ts +1 -1
  54. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,6 +1,167 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## v1.22.0
5
+
6
+ [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.21.0...v1.22.0)
7
+
8
+ ### 🚀 Enhancements
9
+
10
+ - Password reset url is configurable ([0a3d443](https://github.com/rrd108/nuxt-users/commit/0a3d443))
11
+
12
+ ### 🩹 Fixes
13
+
14
+ - Imports setup ([dd8e8df](https://github.com/rrd108/nuxt-users/commit/dd8e8df))
15
+
16
+ ### 💅 Refactors
17
+
18
+ - Vue SFC type resolution during module build ([533fa36](https://github.com/rrd108/nuxt-users/commit/533fa36))
19
+
20
+ ### 🏡 Chore
21
+
22
+ - Remove unused file ([14bea18](https://github.com/rrd108/nuxt-users/commit/14bea18))
23
+ - Lint fix ([a11887b](https://github.com/rrd108/nuxt-users/commit/a11887b))
24
+ - **release:** V1.21.0 ([3eb08bd](https://github.com/rrd108/nuxt-users/commit/3eb08bd))
25
+ - Update ip ([3139eab](https://github.com/rrd108/nuxt-users/commit/3139eab))
26
+ - Removes unused import ([61089b4](https://github.com/rrd108/nuxt-users/commit/61089b4))
27
+ - Unused imort removed ([3f3012f](https://github.com/rrd108/nuxt-users/commit/3f3012f))
28
+ - Remove unsued import ([ae1f4e3](https://github.com/rrd108/nuxt-users/commit/ae1f4e3))
29
+
30
+ ### ❤️ Contributors
31
+
32
+ - Rrd108 ([@rrd108](https://github.com/rrd108))
33
+
34
+ ## v1.21.0
35
+
36
+ [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.18.0...v1.21.0)
37
+
38
+ ### 🚀 Enhancements
39
+
40
+ - Handle forgot password ([e9a90b6](https://github.com/rrd108/nuxt-users/commit/e9a90b6))
41
+
42
+ ### 🩹 Fixes
43
+
44
+ - Updates build command to include stub generation ([c36ac34](https://github.com/rrd108/nuxt-users/commit/c36ac34))
45
+ - Improves database connection handling ([3982c0c](https://github.com/rrd108/nuxt-users/commit/3982c0c))
46
+ - Imports setup ([dd8e8df](https://github.com/rrd108/nuxt-users/commit/dd8e8df))
47
+
48
+ ### 💅 Refactors
49
+
50
+ - Imports ([c5723f9](https://github.com/rrd108/nuxt-users/commit/c5723f9))
51
+ - Utils directory and fixes import paths ([7dd48f6](https://github.com/rrd108/nuxt-users/commit/7dd48f6))
52
+
53
+ ### 📖 Documentation
54
+
55
+ - Reorganizes structure ([bd710cd](https://github.com/rrd108/nuxt-users/commit/bd710cd))
56
+
57
+ ### 🏡 Chore
58
+
59
+ - **release:** V1.18.0 ([9f1cdfb](https://github.com/rrd108/nuxt-users/commit/9f1cdfb))
60
+ - **release:** V1.19.0 ([ac2d375](https://github.com/rrd108/nuxt-users/commit/ac2d375))
61
+ - **release:** V1.20.0 ([1186e63](https://github.com/rrd108/nuxt-users/commit/1186e63))
62
+ - Remove unused file ([14bea18](https://github.com/rrd108/nuxt-users/commit/14bea18))
63
+ - Lint fix ([a11887b](https://github.com/rrd108/nuxt-users/commit/a11887b))
64
+
65
+ ### ✅ Tests
66
+
67
+ - **ci:** Fix postgres fail on ([4a1a092](https://github.com/rrd108/nuxt-users/commit/4a1a092))
68
+
69
+ ### ❤️ Contributors
70
+
71
+ - Rrd108 ([@rrd108](https://github.com/rrd108))
72
+
73
+ ## v1.20.0
74
+
75
+ [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.18.0...v1.20.0)
76
+
77
+ ### 🚀 Enhancements
78
+
79
+ - Handle forgot password ([e9a90b6](https://github.com/rrd108/nuxt-users/commit/e9a90b6))
80
+
81
+ ### 🩹 Fixes
82
+
83
+ - Updates build command to include stub generation ([c36ac34](https://github.com/rrd108/nuxt-users/commit/c36ac34))
84
+
85
+ ### 💅 Refactors
86
+
87
+ - Imports ([c5723f9](https://github.com/rrd108/nuxt-users/commit/c5723f9))
88
+ - Utils directory and fixes import paths ([7dd48f6](https://github.com/rrd108/nuxt-users/commit/7dd48f6))
89
+
90
+ ### 📖 Documentation
91
+
92
+ - Reorganizes structure ([bd710cd](https://github.com/rrd108/nuxt-users/commit/bd710cd))
93
+
94
+ ### 🏡 Chore
95
+
96
+ - **release:** V1.18.0 ([9f1cdfb](https://github.com/rrd108/nuxt-users/commit/9f1cdfb))
97
+ - **release:** V1.19.0 ([ac2d375](https://github.com/rrd108/nuxt-users/commit/ac2d375))
98
+
99
+ ### ✅ Tests
100
+
101
+ - **ci:** Fix postgres fail on ([4a1a092](https://github.com/rrd108/nuxt-users/commit/4a1a092))
102
+
103
+ ### ❤️ Contributors
104
+
105
+ - Rrd108 ([@rrd108](https://github.com/rrd108))
106
+
107
+ ## v1.19.0
108
+
109
+ [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.18.0...v1.19.0)
110
+
111
+ ### 🚀 Enhancements
112
+
113
+ - Handle forgot password ([e9a90b6](https://github.com/rrd108/nuxt-users/commit/e9a90b6))
114
+
115
+ ### 🩹 Fixes
116
+
117
+ - Updates build command to include stub generation ([c36ac34](https://github.com/rrd108/nuxt-users/commit/c36ac34))
118
+
119
+ ### 💅 Refactors
120
+
121
+ - Imports ([c5723f9](https://github.com/rrd108/nuxt-users/commit/c5723f9))
122
+ - Utils directory and fixes import paths ([7dd48f6](https://github.com/rrd108/nuxt-users/commit/7dd48f6))
123
+
124
+ ### 📖 Documentation
125
+
126
+ - Reorganizes structure ([bd710cd](https://github.com/rrd108/nuxt-users/commit/bd710cd))
127
+
128
+ ### 🏡 Chore
129
+
130
+ - **release:** V1.18.0 ([9f1cdfb](https://github.com/rrd108/nuxt-users/commit/9f1cdfb))
131
+
132
+ ### ❤️ Contributors
133
+
134
+ - Rrd108 ([@rrd108](https://github.com/rrd108))
135
+
136
+ ## v1.18.0
137
+
138
+ [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.17.3...v1.18.0)
139
+
140
+ ### 🚀 Enhancements
141
+
142
+ - Handle forgot password ([e9a90b6](https://github.com/rrd108/nuxt-users/commit/e9a90b6))
143
+
144
+ ### 🩹 Fixes
145
+
146
+ - Cli version ([586194f](https://github.com/rrd108/nuxt-users/commit/586194f))
147
+ - Use runtime config for password reset link ([f462f64](https://github.com/rrd108/nuxt-users/commit/f462f64))
148
+
149
+ ### 💅 Refactors
150
+
151
+ - Imports ([c5723f9](https://github.com/rrd108/nuxt-users/commit/c5723f9))
152
+
153
+ ### 📖 Documentation
154
+
155
+ - Reorganizes structure ([bd710cd](https://github.com/rrd108/nuxt-users/commit/bd710cd))
156
+
157
+ ### 🏡 Chore
158
+
159
+ - **release:** V1.17.3 ([29f0dbc](https://github.com/rrd108/nuxt-users/commit/29f0dbc))
160
+
161
+ ### ❤️ Contributors
162
+
163
+ - Rrd108 ([@rrd108](https://github.com/rrd108))
164
+
4
165
  ## v1.17.3
5
166
 
6
167
  [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.17.2...v1.17.3)
package/dist/module.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { R as RuntimeModuleOptions, M as ModuleOptions } from './shared/nuxt-users.B8X7pDsj.mjs';
2
+ import { R as RuntimeModuleOptions, M as ModuleOptions } from './shared/nuxt-users.CqP-FK1T.mjs';
3
3
  export * from '../dist/runtime/server/internal/index.js';
4
4
 
5
5
  declare const defaultOptions: ModuleOptions;
package/dist/module.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _nuxt_schema from '@nuxt/schema';
2
- import { R as RuntimeModuleOptions, M as ModuleOptions } from './shared/nuxt-users.B8X7pDsj.js';
2
+ import { R as RuntimeModuleOptions, M as ModuleOptions } from './shared/nuxt-users.CqP-FK1T.js';
3
3
  export * from '../dist/runtime/server/internal/index.js';
4
4
 
5
5
  declare const defaultOptions: ModuleOptions;
package/dist/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "nuxt-users",
3
3
  "configKey": "nuxtUsers",
4
- "version": "1.17.3",
4
+ "version": "1.22.0",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.0"
package/dist/module.mjs CHANGED
@@ -31,7 +31,7 @@ const defaultOptions = {
31
31
  from: '"Nuxt Users Module" <noreply@example.com>'
32
32
  }
33
33
  },
34
- passwordResetBaseUrl: "http://localhost:3000",
34
+ passwordResetUrl: "/reset-password",
35
35
  auth: {
36
36
  whitelist: [],
37
37
  tokenExpiration: 24 * 60,
@@ -61,6 +61,7 @@ const module = defineNuxtModule({
61
61
  nuxt.options.runtimeConfig.nuxtUsers = {
62
62
  ...runtimeConfigOptions,
63
63
  apiBasePath: options.apiBasePath || defaultOptions.apiBasePath,
64
+ passwordResetUrl: options.passwordResetUrl || defaultOptions.passwordResetUrl,
64
65
  tables: {
65
66
  migrations: options.tables?.migrations || defaultOptions.tables.migrations,
66
67
  users: options.tables?.users || defaultOptions.tables.users,
@@ -1,20 +1,13 @@
1
- import { type DisplayFieldsProps, type User } from '#nuxt-users/types';
1
+ interface Props {
2
+ displayFields?: string[];
3
+ fieldLabels?: Record<string, string>;
4
+ }
2
5
  declare var __VLS_1: {}, __VLS_3: {
3
6
  loading: boolean;
4
7
  }, __VLS_5: {
5
8
  error: string | null;
6
9
  }, __VLS_7: {}, __VLS_9: {}, __VLS_11: {
7
- user: {
8
- id: number;
9
- email: string;
10
- name: string;
11
- password: string;
12
- role: string;
13
- active: boolean;
14
- created_at: string;
15
- updated_at: string;
16
- last_login_at?: string | undefined;
17
- };
10
+ user: any;
18
11
  index: number;
19
12
  }, __VLS_22: {
20
13
  pagination: {
@@ -54,12 +47,12 @@ type __VLS_Slots = {} & {
54
47
  } & {
55
48
  pagination?: (props: typeof __VLS_24) => any;
56
49
  };
57
- declare const __VLS_component: import("vue").DefineComponent<DisplayFieldsProps, {
50
+ declare const __VLS_component: import("vue").DefineComponent<Props, {
58
51
  refresh: () => void;
59
52
  }, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
60
53
  delete: (user: User) => void;
61
54
  editClick: (user: User) => void;
62
- }, string, import("vue").PublicProps, Readonly<DisplayFieldsProps> & Readonly<{
55
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
63
56
  onDelete?: ((user: User) => any) | undefined;
64
57
  onEditClick?: ((user: User) => any) | undefined;
65
58
  }>, {
@@ -6,8 +6,8 @@ const { public: { nuxtUsers } } = useRuntimeConfig();
6
6
  const { passwordValidation } = nuxtUsers;
7
7
  const props = defineProps({
8
8
  apiEndpoint: { type: String, required: false },
9
- redirectTo: { type: String, required: false },
10
- forgotPasswordEndpoint: { type: String, required: false }
9
+ forgotPasswordEndpoint: { type: String, required: false },
10
+ redirectTo: { type: String, required: false }
11
11
  });
12
12
  const emit = defineEmits(["success", "error", "forgot-password-error", "submit", "forgot-password-success"]);
13
13
  const apiEndpoint = computed(() => props.apiEndpoint || `${nuxtUsers?.apiBasePath}/session`);
@@ -1,4 +1,8 @@
1
- import type { LoginFormData, LoginFormProps, UserWithoutPassword } from '#nuxt-users/types';
1
+ interface Props {
2
+ apiEndpoint?: string;
3
+ forgotPasswordEndpoint?: string;
4
+ redirectTo?: string;
5
+ }
2
6
  declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {}, __VLS_9: {}, __VLS_11: {}, __VLS_13: {
3
7
  message: string;
4
8
  }, __VLS_15: {
@@ -21,13 +25,13 @@ type __VLS_Slots = {} & {
21
25
  } & {
22
26
  'error-message'?: (props: typeof __VLS_15) => any;
23
27
  };
24
- declare const __VLS_component: import("vue").DefineComponent<LoginFormProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
28
+ declare const __VLS_component: import("vue").DefineComponent<Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
25
29
  error: (error: string) => any;
26
30
  submit: (data: LoginFormData) => any;
27
31
  success: (user: UserWithoutPassword) => any;
28
32
  "forgot-password-error": (error: string) => any;
29
33
  "forgot-password-success": () => any;
30
- }, string, import("vue").PublicProps, Readonly<LoginFormProps> & Readonly<{
34
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
31
35
  onError?: ((error: string) => any) | undefined;
32
36
  onSubmit?: ((data: LoginFormData) => any) | undefined;
33
37
  onSuccess?: ((user: UserWithoutPassword) => any) | undefined;
@@ -1,9 +1,9 @@
1
1
  <script setup>
2
2
  import { computed } from "vue";
3
- import { useRuntimeConfig } from "#imports";
3
+ import { useRuntimeConfig } from "#app";
4
4
  const props = defineProps({
5
5
  password: { type: String, required: true },
6
- validationResult: { type: [Object, null], required: true },
6
+ validationResult: { type: null, required: true },
7
7
  showHints: { type: Boolean, required: false, default: true },
8
8
  showRules: { type: Boolean, required: false, default: true }
9
9
  });
@@ -1,4 +1,4 @@
1
- import type { PasswordValidationResult } from '../../utils/index.js';
1
+ import type { PasswordValidationResult } from 'nuxt-users/utils';
2
2
  interface Props {
3
3
  password: string;
4
4
  validationResult: PasswordValidationResult | null;
@@ -1,18 +1,26 @@
1
1
  <script setup>
2
- import { ref, watch } from "vue";
2
+ import { ref, watch, computed } from "vue";
3
3
  import { usePasswordValidation } from "../composables/usePasswordValidation";
4
- import { useRuntimeConfig } from "#imports";
4
+ import { useRuntimeConfig, useRoute, useRouter } from "#imports";
5
5
  import NUsersPasswordStrengthIndicator from "./NUsersPasswordStrengthIndicator.vue";
6
6
  const { public: { nuxtUsers } } = useRuntimeConfig();
7
7
  const moduleOptions = nuxtUsers;
8
8
  const props = defineProps({
9
- apiEndpoint: { type: String, required: false },
10
- updatePasswordEndpoint: { type: String, required: false }
9
+ updatePasswordEndpoint: { type: String, required: false },
10
+ resetPasswordEndpoint: { type: String, required: false },
11
+ redirectTo: { type: String, required: false }
11
12
  });
12
13
  const emit = defineEmits(["success", "error", "password-error", "password-updated"]);
14
+ const route = useRoute();
15
+ const router = useRouter();
13
16
  const isPasswordLoading = ref(false);
14
17
  const passwordError = ref("");
15
18
  const passwordSuccess = ref("");
19
+ const isPasswordReset = computed(() => {
20
+ return route.query.token && route.query.email;
21
+ });
22
+ const resetToken = computed(() => route.query.token);
23
+ const resetEmail = computed(() => route.query.email);
16
24
  const passwordForm = ref({
17
25
  currentPassword: "",
18
26
  newPassword: "",
@@ -50,16 +58,75 @@ const updatePassword = async () => {
50
58
  isPasswordLoading.value = false;
51
59
  }
52
60
  };
61
+ const resetPassword = async () => {
62
+ if (!resetToken.value || !resetEmail.value) {
63
+ passwordError.value = "Missing reset token or email. Please use the link from your email.";
64
+ return;
65
+ }
66
+ if (passwordForm.value.newPassword !== passwordForm.value.newPasswordConfirmation) {
67
+ passwordError.value = "Passwords do not match";
68
+ return;
69
+ }
70
+ isPasswordLoading.value = true;
71
+ passwordError.value = "";
72
+ passwordSuccess.value = "";
73
+ try {
74
+ await $fetch(props.resetPasswordEndpoint || nuxtUsers.apiBasePath + "/password/reset", {
75
+ method: "POST",
76
+ body: {
77
+ token: resetToken.value,
78
+ email: resetEmail.value,
79
+ password: passwordForm.value.newPassword,
80
+ password_confirmation: passwordForm.value.newPasswordConfirmation
81
+ }
82
+ });
83
+ passwordSuccess.value = "Password reset successfully. You can now log in with your new password.";
84
+ emit("password-updated");
85
+ passwordForm.value = {
86
+ currentPassword: "",
87
+ newPassword: "",
88
+ newPasswordConfirmation: ""
89
+ };
90
+ setTimeout(() => {
91
+ router.push(props.redirectTo || "/login");
92
+ }, 2e3);
93
+ } catch (err) {
94
+ const errorMessage = err && typeof err === "object" && "data" in err && err.data && typeof err.data === "object" && "statusMessage" in err.data ? String(err.data.statusMessage) : err instanceof Error ? err.message : "Failed to reset password";
95
+ passwordError.value = errorMessage;
96
+ emit("password-error", errorMessage);
97
+ } finally {
98
+ isPasswordLoading.value = false;
99
+ }
100
+ };
101
+ const handleSubmit = () => {
102
+ if (isPasswordReset.value) {
103
+ resetPassword();
104
+ } else {
105
+ updatePassword();
106
+ }
107
+ };
53
108
  </script>
54
109
 
55
110
  <template>
56
111
  <div class="n-users-section">
57
112
  <h2 class="n-users-section-header">
58
- Change Password
113
+ {{ isPasswordReset ? "Reset Password" : "Change Password" }}
59
114
  </h2>
60
115
 
61
- <form @submit.prevent="updatePassword">
62
- <div class="n-users-form-group">
116
+ <div
117
+ v-if="isPasswordReset"
118
+ class="n-users-info-message"
119
+ >
120
+ <p>You are resetting your password using a secure link.</p>
121
+ <p><strong>Email:</strong> {{ resetEmail }}</p>
122
+ </div>
123
+
124
+ <form @submit.prevent="handleSubmit">
125
+ <!-- Current Password field - only show for logged-in users -->
126
+ <div
127
+ v-if="!isPasswordReset"
128
+ class="n-users-form-group"
129
+ >
63
130
  <label
64
131
  for="currentPassword"
65
132
  class="n-users-form-label"
@@ -78,7 +145,7 @@ const updatePassword = async () => {
78
145
  <label
79
146
  for="newPassword"
80
147
  class="n-users-form-label"
81
- >New Password</label>
148
+ >{{ isPasswordReset ? "New Password" : "New Password" }}</label>
82
149
  <input
83
150
  id="newPassword"
84
151
  v-model="passwordForm.newPassword"
@@ -108,7 +175,7 @@ const updatePassword = async () => {
108
175
  <label
109
176
  for="newPasswordConfirmation"
110
177
  class="n-users-form-label"
111
- >Confirm New Password</label>
178
+ >Confirm {{ isPasswordReset ? "New Password" : "New Password" }}</label>
112
179
  <input
113
180
  id="newPasswordConfirmation"
114
181
  v-model="passwordForm.newPasswordConfirmation"
@@ -138,8 +205,12 @@ const updatePassword = async () => {
138
205
  class="n-users-btn n-users-btn-primary"
139
206
  :disabled="isPasswordLoading"
140
207
  >
141
- <span v-if="isPasswordLoading">Updating...</span>
142
- <span v-else>Update Password</span>
208
+ <span v-if="isPasswordLoading">
209
+ {{ isPasswordReset ? "Resetting..." : "Updating..." }}
210
+ </span>
211
+ <span v-else>
212
+ {{ isPasswordReset ? "Reset Password" : "Update Password" }}
213
+ </span>
143
214
  </button>
144
215
  </form>
145
216
  </div>
@@ -1,10 +1,14 @@
1
- import type { UserWithoutPassword, ResetPasswordFormProps } from '#nuxt-users/types';
2
- declare const _default: import("vue").DefineComponent<ResetPasswordFormProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
1
+ interface Props {
2
+ updatePasswordEndpoint?: string;
3
+ resetPasswordEndpoint?: string;
4
+ redirectTo?: string;
5
+ }
6
+ declare const _default: import("vue").DefineComponent<Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
3
7
  error: (error: string) => any;
4
8
  success: (user: UserWithoutPassword) => any;
5
9
  "password-error": (error: string) => any;
6
10
  "password-updated": () => any;
7
- }, string, import("vue").PublicProps, Readonly<ResetPasswordFormProps> & Readonly<{
11
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
8
12
  onError?: ((error: string) => any) | undefined;
9
13
  onSuccess?: ((user: UserWithoutPassword) => any) | undefined;
10
14
  "onPassword-error"?: ((error: string) => any) | undefined;
@@ -4,7 +4,7 @@ import { useAuthentication } from "../composables/useAuthentication";
4
4
  import { useRuntimeConfig } from "#imports";
5
5
  import { defaultDisplayFields, defaultFieldLabels } from "nuxt-users/utils";
6
6
  const props = defineProps({
7
- user: { type: Object, required: true },
7
+ user: { type: null, required: true },
8
8
  index: { type: Number, required: true },
9
9
  displayFields: { type: Array, required: false, default: () => defaultDisplayFields },
10
10
  fieldLabels: { type: Object, required: false, default: () => defaultFieldLabels }
@@ -1,7 +1,9 @@
1
- import { type DisplayFieldsProps, type User } from '#nuxt-users/types';
2
- interface Props extends DisplayFieldsProps {
1
+ import { type User } from 'nuxt-users/utils';
2
+ interface Props {
3
3
  user: User;
4
4
  index: number;
5
+ displayFields?: string[];
6
+ fieldLabels?: Record<string, string>;
5
7
  }
6
8
  declare var __VLS_1: {
7
9
  user: User;
@@ -3,7 +3,7 @@ import { ref, computed, watch } from "vue";
3
3
  import { usePasswordValidation } from "../composables/usePasswordValidation";
4
4
  import { useRuntimeConfig } from "#imports";
5
5
  const props = defineProps({
6
- user: { type: [Object, null], required: false }
6
+ user: { type: null, required: false }
7
7
  });
8
8
  const emit = defineEmits(["submit", "cancel"]);
9
9
  const emptyFormData = {
@@ -1,12 +1,12 @@
1
- import type { User } from '#nuxt-users/types';
2
- type __VLS_Props = {
1
+ import type { User } from 'nuxt-users/utils';
2
+ interface Props {
3
3
  user?: User | null;
4
- };
5
- declare const _default: import("vue").DefineComponent<__VLS_Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
4
+ }
5
+ declare const _default: import("vue").DefineComponent<Props, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
6
6
  cancel: () => any;
7
- submit: (userData: Partial<User>) => any;
8
- }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
7
+ submit: (userData: User) => any;
8
+ }, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
9
9
  onCancel?: (() => any) | undefined;
10
- onSubmit?: ((userData: Partial<User>) => any) | undefined;
10
+ onSubmit?: ((userData: User) => any) | undefined;
11
11
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
12
12
  export default _default;
@@ -1,27 +1,9 @@
1
- import type { User, UserWithoutPassword } from '#nuxt-users/types';
1
+ import type { User } from 'nuxt-users/utils';
2
2
  export declare const useAuthentication: () => {
3
- user: Readonly<import("vue").Ref<{
4
- readonly id: number;
5
- readonly email: string;
6
- readonly name: string;
7
- readonly role: string;
8
- readonly active: boolean;
9
- readonly created_at: string;
10
- readonly updated_at: string;
11
- readonly last_login_at?: string | undefined;
12
- } | null, {
13
- readonly id: number;
14
- readonly email: string;
15
- readonly name: string;
16
- readonly role: string;
17
- readonly active: boolean;
18
- readonly created_at: string;
19
- readonly updated_at: string;
20
- readonly last_login_at?: string | undefined;
21
- } | null>>;
3
+ user: Readonly<import("vue").Ref<any, any>>;
22
4
  isAuthenticated: import("vue").ComputedRef<boolean>;
23
5
  login: (userData: User) => void;
24
6
  logout: () => Promise<void>;
25
- fetchUser: () => Promise<UserWithoutPassword | null>;
7
+ fetchUser: () => Promise<any>;
26
8
  initializeUser: () => Promise<void>;
27
9
  };
@@ -1,5 +1,5 @@
1
1
  import { type PasswordValidationResult, type PasswordValidationOptions } from '../../utils/index.js';
2
- import type { RuntimeModuleOptions } from '#nuxt-users/types';
2
+ import type { RuntimeModuleOptions } from 'nuxt-users/utils';
3
3
  export declare const usePasswordValidation: (moduleOptions?: RuntimeModuleOptions, options?: PasswordValidationOptions) => {
4
4
  password: import("vue").Ref<string, string>;
5
5
  validationResult: import("vue").Ref<{
@@ -1,5 +1,5 @@
1
1
  import { ref, computed } from "vue";
2
- import { validatePassword, getPasswordValidationOptions, getPasswordStrengthColor, getPasswordStrengthText } from "../../utils.js";
2
+ import { validatePassword, getPasswordValidationOptions, getPasswordStrengthColor, getPasswordStrengthText } from "../../utils";
3
3
  export const usePasswordValidation = (moduleOptions, options) => {
4
4
  const passwordOptions = getPasswordValidationOptions(moduleOptions);
5
5
  const finalOptions = { ...passwordOptions, ...options };
@@ -1,2 +1,2 @@
1
- export const NO_AUTH_PATHS = ["/login"];
1
+ export const NO_AUTH_PATHS = ["/login", "/reset-password"];
2
2
  export const NO_AUTH_API_PATHS = ["/session", "/password/forgot", "/password/reset"];
@@ -1,4 +1,4 @@
1
1
  declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
- user: import("#nuxt-users/types").UserWithoutPassword;
2
+ user: any;
3
3
  }>>;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
1
  declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
- user: import("#nuxt-users/types").UserWithoutPassword;
2
+ user: UserWithoutPassword;
3
3
  }>>;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
1
  declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
- user: Omit<import("#nuxt-users/types").User, "password">;
2
+ user: Omit<User, "password">;
3
3
  }>>;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
1
  declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
- user: import("#nuxt-users/types").UserWithoutPassword;
2
+ user: any;
3
3
  }>>;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
1
  declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
- user: import("#nuxt-users/types").UserWithoutPassword;
2
+ user: UserWithoutPassword;
3
3
  }>>;
4
4
  export default _default;
@@ -1,4 +1,4 @@
1
- import { defineEventHandler, readBody, createError } from "h3";
1
+ import { defineEventHandler, readBody, createError, getHeader } from "h3";
2
2
  import { sendPasswordResetLink } from "../../../services/password.js";
3
3
  import { useRuntimeConfig } from "#imports";
4
4
  export default defineEventHandler(async (event) => {
@@ -13,7 +13,10 @@ export default defineEventHandler(async (event) => {
13
13
  });
14
14
  }
15
15
  try {
16
- await sendPasswordResetLink(email, options);
16
+ const host = getHeader(event, "host");
17
+ const protocol = getHeader(event, "x-forwarded-proto") || "http";
18
+ const baseUrl = host ? `${protocol}://${host}` : void 0;
19
+ await sendPasswordResetLink(email, options, baseUrl);
17
20
  return { message: "If a user with that email exists, a password reset link has been sent." };
18
21
  } catch (error) {
19
22
  if (error instanceof Error) {
@@ -1,8 +1,8 @@
1
1
  import { createError, defineEventHandler, getCookie, readBody } from "h3";
2
2
  import bcrypt from "bcrypt";
3
3
  import { useRuntimeConfig } from "#imports";
4
- import { getCurrentUserFromToken, updateUserPassword } from "../../../utils/index.js";
5
- import { validatePassword, getPasswordValidationOptions } from "../../../../../utils.js";
4
+ import { getCurrentUserFromToken, updateUserPassword } from "../../../utils/user.js";
5
+ import { validatePassword, getPasswordValidationOptions } from "../../../../../utils";
6
6
  export default defineEventHandler(async (event) => {
7
7
  const { nuxtUsers } = useRuntimeConfig();
8
8
  const options = nuxtUsers;
@@ -1,7 +1,7 @@
1
1
  import { defineEventHandler, readBody, createError, H3Error } from "h3";
2
2
  import { resetPassword } from "../../../services/password.js";
3
3
  import { useRuntimeConfig } from "#imports";
4
- import { validatePassword, getPasswordValidationOptions } from "../../../../../utils.js";
4
+ import { validatePassword, getPasswordValidationOptions } from "../../../../../utils";
5
5
  export default defineEventHandler(async (event) => {
6
6
  const body = await readBody(event);
7
7
  const { token, email, password, password_confirmation } = body;
@@ -1,6 +1,6 @@
1
1
  import { defineEventHandler, getCookie, setCookie } from "h3";
2
2
  import { useRuntimeConfig } from "#imports";
3
- import { useDb } from "../../../utils/index.js";
3
+ import { useDb } from "../../../utils/db.js";
4
4
  export default defineEventHandler(async (event) => {
5
5
  const { nuxtUsers } = useRuntimeConfig();
6
6
  const options = nuxtUsers;
@@ -1,13 +1,4 @@
1
1
  declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
- user: {
3
- id: number;
4
- email: string;
5
- name: string;
6
- role: string;
7
- active: boolean;
8
- created_at: string;
9
- updated_at: string;
10
- last_login_at?: string;
11
- };
2
+ user: User;
12
3
  }>>;
13
4
  export default _default;
@@ -2,7 +2,7 @@ import { createError, defineEventHandler, readBody, setCookie } from "h3";
2
2
  import bcrypt from "bcrypt";
3
3
  import crypto from "node:crypto";
4
4
  import { useRuntimeConfig } from "#imports";
5
- import { useDb } from "../../../utils/index.js";
5
+ import { useDb } from "../../../utils/db.js";
6
6
  export default defineEventHandler(async (event) => {
7
7
  const body = await readBody(event);
8
8
  const { email, password } = body;
@@ -1,15 +1,7 @@
1
1
  export declare const useNuxtUsersDatabase: () => Promise<{
2
- database: import("db0").Database<import("db0").Connector<Database.Database>>;
2
+ database: import("db0").Database<import("db0").Connector<unknown>>;
3
3
  options: {
4
- tables: {
5
- migrations: string;
6
- users: string;
7
- personalAccessTokens: string;
8
- passwordResetTokens: string;
9
- };
10
- connector: {
11
- name: import("#nuxt-users/types").DatabaseType;
12
- options: import("#nuxt-users/types").DatabaseConfig;
13
- };
4
+ tables: any;
5
+ connector: any;
14
6
  };
15
7
  }>;
@@ -1,4 +1,4 @@
1
- import type { UserWithoutPassword } from '#nuxt-users/types';
1
+ import type { UserWithoutPassword } from 'nuxt-users/utils';
2
2
  /**
3
3
  * Server-side composable for authentication utilities
4
4
  *
@@ -11,7 +11,11 @@ export default defineEventHandler(async (event) => {
11
11
  if (!isPageOrApiRoute) {
12
12
  return;
13
13
  }
14
- if (NO_AUTH_PATHS.includes(event.path)) {
14
+ const noAuthPaths = [...NO_AUTH_PATHS];
15
+ if (options.passwordResetUrl && options.passwordResetUrl !== "/reset-password") {
16
+ noAuthPaths.push(options.passwordResetUrl);
17
+ }
18
+ if (noAuthPaths.includes(event.path)) {
15
19
  console.log(`[Nuxt Users] server.middleware.auth.global: NO_AUTH_PATH: ${event.path}`);
16
20
  return;
17
21
  }
@@ -1,8 +1,8 @@
1
- import type { ModuleOptions } from '#nuxt-users/types';
1
+ import type { ModuleOptions } from 'nuxt-users/utils';
2
2
  /**
3
3
  * Generates a password reset link and sends it to the user's email.
4
4
  */
5
- export declare const sendPasswordResetLink: (email: string, options: ModuleOptions) => Promise<void>;
5
+ export declare const sendPasswordResetLink: (email: string, options: ModuleOptions, baseUrl?: string) => Promise<void>;
6
6
  /**
7
7
  * Resets the user's password using a valid token.
8
8
  */
@@ -3,7 +3,7 @@ import crypto from "node:crypto";
3
3
  import bcrypt from "bcrypt";
4
4
  import { findUserByEmail, updateUserPassword, useDb } from "../utils/index.js";
5
5
  const TOKEN_EXPIRATION_HOURS = 1;
6
- export const sendPasswordResetLink = async (email, options) => {
6
+ export const sendPasswordResetLink = async (email, options, baseUrl) => {
7
7
  const user = await findUserByEmail(email, options);
8
8
  if (!user) {
9
9
  console.log(`[Nuxt Users] Password reset requested for non-existent email: ${email}`);
@@ -30,7 +30,8 @@ export const sendPasswordResetLink = async (email, options) => {
30
30
  pass: options.mailer.auth.pass
31
31
  }
32
32
  });
33
- const resetUrl = new URL("/reset-password", options.passwordResetBaseUrl || "http://localhost:3000");
33
+ const appBaseUrl = baseUrl || "http://localhost:3000";
34
+ const resetUrl = new URL(options.passwordResetUrl, appBaseUrl);
34
35
  resetUrl.searchParams.set("token", token);
35
36
  resetUrl.searchParams.set("email", email);
36
37
  const resetLink = resetUrl.toString();
@@ -1,2 +1,2 @@
1
- import type { ModuleOptions } from '#nuxt-users/types';
1
+ import type { ModuleOptions } from 'nuxt-users/utils';
2
2
  export declare const addActiveToUsers: (options: ModuleOptions) => Promise<void>;
@@ -1,2 +1,2 @@
1
- import type { ModuleOptions } from '#nuxt-users/types';
1
+ import type { ModuleOptions } from 'nuxt-users/utils';
2
2
  export declare const createMigrationsTable: (options: ModuleOptions) => Promise<void>;
@@ -1,2 +1,2 @@
1
- import type { ModuleOptions } from '#nuxt-users/types';
1
+ import type { ModuleOptions } from 'nuxt-users/utils';
2
2
  export declare const createPasswordResetTokensTable: (options: ModuleOptions) => Promise<void>;
@@ -1,2 +1,2 @@
1
- import type { ModuleOptions } from '#nuxt-users/types';
1
+ import type { ModuleOptions } from 'nuxt-users/utils';
2
2
  export declare const createPersonalAccessTokensTable: (options: ModuleOptions) => Promise<void>;
@@ -1,2 +1,2 @@
1
- import type { ModuleOptions } from '#nuxt-users/types';
1
+ import type { ModuleOptions } from 'nuxt-users/utils';
2
2
  export declare const createUsersTable: (options: ModuleOptions) => Promise<void>;
@@ -1,4 +1,6 @@
1
- import type { ModuleOptions } from '#nuxt-users/types';
1
+ import type { Database } from 'db0';
2
+ import type { ModuleOptions } from 'nuxt-users/utils';
3
+ export declare const closeAllDbConnections: () => Promise<void>;
2
4
  export declare const getConnector: (name: string) => Promise<typeof import("db0/connectors/mysql2").default | typeof import("db0/connectors/postgresql").default | typeof import("db0/connectors/better-sqlite3").default>;
3
- export declare const useDb: (options: ModuleOptions) => Promise<import("db0").Database<import("db0").Connector<Database.Database>>>;
5
+ export declare const useDb: (options: ModuleOptions) => Promise<Database>;
4
6
  export declare const checkTableExists: (options: ModuleOptions, tableName: string) => Promise<boolean>;
@@ -1,4 +1,13 @@
1
1
  import { createDatabase } from "db0";
2
+ const dbCache = /* @__PURE__ */ new Map();
3
+ export const closeAllDbConnections = async () => {
4
+ for (const db of dbCache.values()) {
5
+ if (db && typeof db.disconnect === "function") {
6
+ await db.disconnect();
7
+ }
8
+ }
9
+ dbCache.clear();
10
+ };
2
11
  export const getConnector = async (name) => {
3
12
  try {
4
13
  switch (name) {
@@ -22,6 +31,10 @@ export const getConnector = async (name) => {
22
31
  }
23
32
  };
24
33
  export const useDb = async (options) => {
34
+ const cacheKey = JSON.stringify(options.connector);
35
+ if (dbCache.has(cacheKey)) {
36
+ return dbCache.get(cacheKey);
37
+ }
25
38
  const connectorName = options.connector.name;
26
39
  const connector = await getConnector(connectorName);
27
40
  const connectorOptions = { ...options.connector.options };
@@ -29,7 +42,9 @@ export const useDb = async (options) => {
29
42
  delete connectorOptions.path;
30
43
  }
31
44
  try {
32
- return createDatabase(connector(connectorOptions));
45
+ const db = createDatabase(connector(connectorOptions));
46
+ dbCache.set(cacheKey, db);
47
+ return db;
33
48
  } catch (error) {
34
49
  console.warn(`[Nuxt Users] \u26A0\uFE0F Failed to connect to ${connectorName} database:`, error instanceof Error ? error.message : "Unknown error");
35
50
  throw error;
@@ -1,4 +1,4 @@
1
- import type { ModuleOptions } from '#nuxt-users/types';
1
+ import type { ModuleOptions } from 'nuxt-users/utils';
2
2
  export declare const getAppliedMigrations: (options: ModuleOptions) => Promise<string[]>;
3
3
  export declare const markMigrationAsApplied: (options: ModuleOptions, migrationName: string) => Promise<void>;
4
4
  export declare const runMigrations: (options: ModuleOptions) => Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { ModuleOptions, User, UserWithoutPassword } from '#nuxt-users/types';
1
+ import type { ModuleOptions, User, UserWithoutPassword } from 'nuxt-users/utils';
2
2
  interface CreateUserParams {
3
3
  email: string;
4
4
  name: string;
@@ -1,6 +1,6 @@
1
1
  import { useDb } from "./db.js";
2
2
  import bcrypt from "bcrypt";
3
- import { validatePassword, getPasswordValidationOptions } from "../../../utils.js";
3
+ import { validatePassword, getPasswordValidationOptions } from "nuxt-users/utils";
4
4
  export const createUser = async (userData, options) => {
5
5
  const db = await useDb(options);
6
6
  const usersTable = options.tables.users;
@@ -0,0 +1,2 @@
1
+ export * from '../../utils/index.js';
2
+ export * from '../../types.js';
@@ -0,0 +1,2 @@
1
+ export * from "../../utils/index";
2
+ export * from "../../types";
@@ -1,4 +1,4 @@
1
- import type { Permission } from '#nuxt-users/types';
1
+ import type { Permission } from './imports.js';
2
2
  /**
3
3
  * Checks if a path matches a pattern (supports wildcards)
4
4
  * @param path - The path to check
@@ -34,10 +34,10 @@ interface RuntimeModuleOptions {
34
34
  */
35
35
  mailer?: MailerOptions;
36
36
  /**
37
- * Base URL for password reset links
38
- * @default 'http://localhost:3000' // Example, will be set in module defaults
37
+ * URL path for password reset page
38
+ * @default '/reset-password'
39
39
  */
40
- passwordResetBaseUrl?: string;
40
+ passwordResetUrl?: string;
41
41
  /**
42
42
  * Skip database checks during module setup to prevent hanging
43
43
  * @default false
@@ -114,7 +114,7 @@ interface ModuleOptions {
114
114
  passwordResetTokens: string;
115
115
  };
116
116
  mailer?: MailerOptions;
117
- passwordResetBaseUrl?: string;
117
+ passwordResetUrl: string;
118
118
  auth: {
119
119
  whitelist: string[];
120
120
  tokenExpiration: number;
@@ -184,6 +184,8 @@ interface LoginFormProps {
184
184
  interface ResetPasswordFormProps {
185
185
  apiEndpoint?: string;
186
186
  updatePasswordEndpoint?: string;
187
+ resetPasswordEndpoint?: string;
188
+ redirectTo?: string;
187
189
  }
188
190
  interface DisplayFieldsProps {
189
191
  displayFields?: string[];
@@ -201,5 +203,5 @@ declare const defaultFieldLabels: {
201
203
  last_login_at: string;
202
204
  };
203
205
 
204
- export { defaultDisplayFields as e, defaultFieldLabels as f };
205
- export type { DisplayFieldsProps as D, LoginFormData as L, ModuleOptions as M, PersonalAccessToken as P, RuntimeModuleOptions as R, User as U, UserWithoutPassword as a, PasswordResetToken as b, LoginFormProps as c, ResetPasswordFormProps as d };
206
+ export { defaultDisplayFields as h, defaultFieldLabels as i };
207
+ export type { DisplayFieldsProps as D, LoginFormData as L, ModuleOptions as M, PersonalAccessToken as P, RuntimeModuleOptions as R, User as U, UserWithoutPassword as a, PasswordResetToken as b, LoginFormProps as c, ResetPasswordFormProps as d, Permission as e, DatabaseType as f, DatabaseConfig as g };
@@ -34,10 +34,10 @@ interface RuntimeModuleOptions {
34
34
  */
35
35
  mailer?: MailerOptions;
36
36
  /**
37
- * Base URL for password reset links
38
- * @default 'http://localhost:3000' // Example, will be set in module defaults
37
+ * URL path for password reset page
38
+ * @default '/reset-password'
39
39
  */
40
- passwordResetBaseUrl?: string;
40
+ passwordResetUrl?: string;
41
41
  /**
42
42
  * Skip database checks during module setup to prevent hanging
43
43
  * @default false
@@ -114,7 +114,7 @@ interface ModuleOptions {
114
114
  passwordResetTokens: string;
115
115
  };
116
116
  mailer?: MailerOptions;
117
- passwordResetBaseUrl?: string;
117
+ passwordResetUrl: string;
118
118
  auth: {
119
119
  whitelist: string[];
120
120
  tokenExpiration: number;
@@ -184,6 +184,8 @@ interface LoginFormProps {
184
184
  interface ResetPasswordFormProps {
185
185
  apiEndpoint?: string;
186
186
  updatePasswordEndpoint?: string;
187
+ resetPasswordEndpoint?: string;
188
+ redirectTo?: string;
187
189
  }
188
190
  interface DisplayFieldsProps {
189
191
  displayFields?: string[];
@@ -201,5 +203,5 @@ declare const defaultFieldLabels: {
201
203
  last_login_at: string;
202
204
  };
203
205
 
204
- export { defaultDisplayFields as e, defaultFieldLabels as f };
205
- export type { DisplayFieldsProps as D, LoginFormData as L, ModuleOptions as M, PersonalAccessToken as P, RuntimeModuleOptions as R, User as U, UserWithoutPassword as a, PasswordResetToken as b, LoginFormProps as c, ResetPasswordFormProps as d };
206
+ export { defaultDisplayFields as h, defaultFieldLabels as i };
207
+ export type { DisplayFieldsProps as D, LoginFormData as L, ModuleOptions as M, PersonalAccessToken as P, RuntimeModuleOptions as R, User as U, UserWithoutPassword as a, PasswordResetToken as b, LoginFormProps as c, ResetPasswordFormProps as d, Permission as e, DatabaseType as f, DatabaseConfig as g };
package/dist/utils.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { D as DisplayFieldsProps, L as LoginFormData, c as LoginFormProps, M as ModuleOptions, b as PasswordResetToken, P as PersonalAccessToken, d as ResetPasswordFormProps, R as RuntimeModuleOptions, U as User, a as UserWithoutPassword, e as defaultDisplayFields, f as defaultFieldLabels } from './shared/nuxt-users.B8X7pDsj.mjs';
1
+ export { g as DatabaseConfig, f as DatabaseType, D as DisplayFieldsProps, L as LoginFormData, c as LoginFormProps, M as ModuleOptions, b as PasswordResetToken, e as Permission, P as PersonalAccessToken, d as ResetPasswordFormProps, R as RuntimeModuleOptions, U as User, a as UserWithoutPassword, h as defaultDisplayFields, i as defaultFieldLabels } from './shared/nuxt-users.CqP-FK1T.mjs';
2
2
 
3
3
  interface PasswordValidationResult {
4
4
  isValid: boolean;
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { D as DisplayFieldsProps, L as LoginFormData, c as LoginFormProps, M as ModuleOptions, b as PasswordResetToken, P as PersonalAccessToken, d as ResetPasswordFormProps, R as RuntimeModuleOptions, U as User, a as UserWithoutPassword, e as defaultDisplayFields, f as defaultFieldLabels } from './shared/nuxt-users.B8X7pDsj.js';
1
+ export { g as DatabaseConfig, f as DatabaseType, D as DisplayFieldsProps, L as LoginFormData, c as LoginFormProps, M as ModuleOptions, b as PasswordResetToken, e as Permission, P as PersonalAccessToken, d as ResetPasswordFormProps, R as RuntimeModuleOptions, U as User, a as UserWithoutPassword, h as defaultDisplayFields, i as defaultFieldLabels } from './shared/nuxt-users.CqP-FK1T.js';
2
2
 
3
3
  interface PasswordValidationResult {
4
4
  isValid: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-users",
3
- "version": "1.17.3",
3
+ "version": "1.22.0",
4
4
  "description": "A comprehensive user management module for Nuxt 3 and Nuxt 4 applications with authentication, authorization, database support, and CLI tools",
5
5
  "keywords": [
6
6
  "nuxt",
@@ -66,13 +66,13 @@
66
66
  "lint": "eslint .",
67
67
  "lint:fix": "eslint . --fix",
68
68
  "pretest": "node -v | grep -q 'v22' || (echo 'Please use Node.js v22 for testing' && exit 1)",
69
- "test": "yarn test:types && yarn test:unit && yarn test:sqlite && yarn test:mysql && yarn test:postgresql",
70
- "test:watch": "vitest watch",
69
+ "test:types": "yarn dev:prepare && vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
71
70
  "test:unit": "./scripts/test-unit.sh",
72
71
  "test:sqlite": "./scripts/test-sqlite.sh",
73
72
  "test:mysql": "./scripts/test-mysql.sh",
74
73
  "test:postgresql": "./scripts/test-postgresql.sh",
75
- "test:types": "vue-tsc --noEmit && cd playground && vue-tsc --noEmit",
74
+ "test": "yarn test:types && yarn test:unit && yarn test:sqlite && yarn test:mysql && yarn test:postgresql",
75
+ "test:watch": "vitest watch",
76
76
  "db:create-users-table": "tsx src/cli/create-users-table.ts",
77
77
  "db:create-user": "tsx src/cli/create-user.ts",
78
78
  "db:create-personal-access-tokens-table": "tsx src/cli/create-personal-access-tokens-table.ts",