nuxt-users 1.17.0 → 1.17.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.
Files changed (38) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/dist/cli.mjs +2 -2
  3. package/dist/module.d.mts +1 -1
  4. package/dist/module.d.ts +1 -1
  5. package/dist/module.json +1 -1
  6. package/dist/runtime/components/NUsersList.vue +1 -1
  7. package/dist/runtime/components/NUsersList.vue.d.ts +1 -1
  8. package/dist/runtime/components/NUsersLoginForm.vue.d.ts +1 -1
  9. package/dist/runtime/components/NUsersResetPasswordForm.vue.d.ts +1 -1
  10. package/dist/runtime/components/NUsersUserCard.vue +1 -1
  11. package/dist/runtime/components/NUsersUserCard.vue.d.ts +1 -1
  12. package/dist/runtime/components/NUsersUserForm.vue.d.ts +1 -1
  13. package/dist/runtime/composables/useAuthentication.d.ts +1 -1
  14. package/dist/runtime/composables/usePasswordValidation.d.ts +1 -1
  15. package/dist/runtime/server/api/nuxt-users/[id].get.d.ts +1 -1
  16. package/dist/runtime/server/api/nuxt-users/[id].patch.d.ts +1 -1
  17. package/dist/runtime/server/api/nuxt-users/index.post.d.ts +1 -1
  18. package/dist/runtime/server/api/nuxt-users/me.get.d.ts +1 -1
  19. package/dist/runtime/server/api/nuxt-users/me.patch.d.ts +1 -1
  20. package/dist/runtime/server/composables/useNuxtUsersDatabase.d.ts +2 -2
  21. package/dist/runtime/server/composables/useServerAuth.d.ts +1 -1
  22. package/dist/runtime/server/services/password.d.ts +1 -1
  23. package/dist/runtime/server/utils/add-active-to-users.d.ts +1 -1
  24. package/dist/runtime/server/utils/create-migrations-table.d.ts +1 -1
  25. package/dist/runtime/server/utils/create-password-reset-tokens-table.d.ts +1 -1
  26. package/dist/runtime/server/utils/create-personal-access-tokens-table.d.ts +1 -1
  27. package/dist/runtime/server/utils/create-users-table.d.ts +1 -1
  28. package/dist/runtime/server/utils/db.d.ts +1 -1
  29. package/dist/runtime/server/utils/migrate.d.ts +1 -1
  30. package/dist/runtime/server/utils/user.d.ts +1 -1
  31. package/dist/runtime/utils/permissions.d.ts +1 -1
  32. package/dist/shared/{nuxt-users.CAfpTSaE.d.mts → nuxt-users.B8X7pDsj.d.mts} +26 -1
  33. package/dist/shared/{nuxt-users.CAfpTSaE.d.ts → nuxt-users.B8X7pDsj.d.ts} +26 -1
  34. package/dist/shared/nuxt-users.BnOQs2LI.mjs +162 -0
  35. package/dist/utils.d.mts +1 -1
  36. package/dist/utils.d.ts +1 -1
  37. package/dist/utils.mjs +13 -160
  38. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,6 +1,53 @@
1
1
  # Changelog
2
2
 
3
3
 
4
+ ## v1.17.2
5
+
6
+ [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.17.1...v1.17.2)
7
+
8
+ ### 🩹 Fixes
9
+
10
+ - Component type import errors ([b1e7329](https://github.com/rrd108/nuxt-users/commit/b1e7329))
11
+ - Import errors ([3e7f99a](https://github.com/rrd108/nuxt-users/commit/3e7f99a))
12
+ - Cli version mismatch ([86d49c4](https://github.com/rrd108/nuxt-users/commit/86d49c4))
13
+ - Import paths and exports types ([16b5a28](https://github.com/rrd108/nuxt-users/commit/16b5a28))
14
+
15
+ ### 🏡 Chore
16
+
17
+ - Bump version number ([7d48235](https://github.com/rrd108/nuxt-users/commit/7d48235))
18
+ - **release:** V1.17.1 ([d1ae8fd](https://github.com/rrd108/nuxt-users/commit/d1ae8fd))
19
+
20
+ ### ❤️ Contributors
21
+
22
+ - Rrd108 ([@rrd108](https://github.com/rrd108))
23
+
24
+ ## v1.17.1
25
+
26
+ [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.17.0...v1.17.1)
27
+
28
+ ### 🩹 Fixes
29
+
30
+ - Component type import errors ([b1e7329](https://github.com/rrd108/nuxt-users/commit/b1e7329))
31
+ - Import errors ([3e7f99a](https://github.com/rrd108/nuxt-users/commit/3e7f99a))
32
+
33
+ ### 💅 Refactors
34
+
35
+ - Prefix css variables ([556bd1e](https://github.com/rrd108/nuxt-users/commit/556bd1e))
36
+
37
+ ### 🏡 Chore
38
+
39
+ - Remove unused css vars ([4add3c4](https://github.com/rrd108/nuxt-users/commit/4add3c4))
40
+ - **release:** V1.17.0 ([c06f70d](https://github.com/rrd108/nuxt-users/commit/c06f70d))
41
+ - Bump version number ([7d48235](https://github.com/rrd108/nuxt-users/commit/7d48235))
42
+
43
+ ### ✅ Tests
44
+
45
+ - Fix for postgres ([2d60019](https://github.com/rrd108/nuxt-users/commit/2d60019))
46
+
47
+ ### ❤️ Contributors
48
+
49
+ - Rrd108 ([@rrd108](https://github.com/rrd108))
50
+
4
51
  ## v1.17.0
5
52
 
6
53
  [compare changes](https://github.com/rrd108/nuxt-users/compare/v1.16.0...v1.17.0)
package/dist/cli.mjs CHANGED
@@ -4,7 +4,7 @@ import { defaultOptions } from './module.mjs';
4
4
  import { loadNuxt } from '@nuxt/kit';
5
5
  import { defu } from 'defu';
6
6
  import { runMigrations, createUser as createUser$1, createUsersTable as createUsersTable$1, createPersonalAccessTokensTable as createPersonalAccessTokensTable$1, createPasswordResetTokensTable as createPasswordResetTokensTable$1, createMigrationsTable as createMigrationsTable$1 } from '../dist/runtime/server/utils/index.js';
7
- import { getPasswordValidationOptions, validatePassword } from './utils.mjs';
7
+ import { g as getPasswordValidationOptions, v as validatePassword } from './shared/nuxt-users.BnOQs2LI.mjs';
8
8
  import { addActiveToUsers as addActiveToUsers$1 } from '../dist/runtime/server/utils/add-active-to-users.js';
9
9
  import '../dist/runtime/server/internal/index.js';
10
10
 
@@ -267,7 +267,7 @@ const main = defineCommand({
267
267
  meta: {
268
268
  name: "nuxt-users",
269
269
  description: "CLI for Nuxt Users Module - Manage users, migrations, and database operations",
270
- version: "1.16.0"
270
+ version: "1.17.2"
271
271
  },
272
272
  subCommands: {
273
273
  migrate,
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.CAfpTSaE.mjs';
2
+ import { R as RuntimeModuleOptions, M as ModuleOptions } from './shared/nuxt-users.B8X7pDsj.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.CAfpTSaE.js';
2
+ import { R as RuntimeModuleOptions, M as ModuleOptions } from './shared/nuxt-users.B8X7pDsj.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.0",
4
+ "version": "1.17.2",
5
5
  "builder": {
6
6
  "@nuxt/module-builder": "1.0.2",
7
7
  "unbuild": "3.6.0"
@@ -1,7 +1,7 @@
1
1
  <script setup>
2
2
  import { ref, onMounted } from "vue";
3
3
  import { useRuntimeConfig } from "#imports";
4
- import { defaultDisplayFields, defaultFieldLabels } from "../../types";
4
+ import { defaultDisplayFields, defaultFieldLabels } from "nuxt-users/utils";
5
5
  defineProps({
6
6
  displayFields: { type: Array, required: false, default: () => defaultDisplayFields },
7
7
  fieldLabels: { type: Object, required: false, default: () => defaultFieldLabels }
@@ -1,4 +1,4 @@
1
- import { type DisplayFieldsProps, type User } from '../../types.js';
1
+ import { type DisplayFieldsProps, type User } from '#nuxt-users/types';
2
2
  declare var __VLS_1: {}, __VLS_3: {
3
3
  loading: boolean;
4
4
  }, __VLS_5: {
@@ -1,4 +1,4 @@
1
- import type { LoginFormData, LoginFormProps, UserWithoutPassword } from '../../types.js';
1
+ import type { LoginFormData, LoginFormProps, UserWithoutPassword } from '#nuxt-users/types';
2
2
  declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {}, __VLS_9: {}, __VLS_11: {}, __VLS_13: {
3
3
  message: string;
4
4
  }, __VLS_15: {
@@ -1,4 +1,4 @@
1
- import type { UserWithoutPassword, ResetPasswordFormProps } from '../../types.js';
1
+ import type { UserWithoutPassword, ResetPasswordFormProps } from '#nuxt-users/types';
2
2
  declare const _default: import("vue").DefineComponent<ResetPasswordFormProps, void, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
3
3
  error: (error: string) => any;
4
4
  success: (user: UserWithoutPassword) => any;
@@ -2,7 +2,7 @@
2
2
  import { computed } from "vue";
3
3
  import { useAuthentication } from "../composables/useAuthentication";
4
4
  import { useRuntimeConfig } from "#imports";
5
- import { defaultDisplayFields, defaultFieldLabels } from "../../types";
5
+ import { defaultDisplayFields, defaultFieldLabels } from "nuxt-users/utils";
6
6
  const props = defineProps({
7
7
  user: { type: Object, required: true },
8
8
  index: { type: Number, required: true },
@@ -1,4 +1,4 @@
1
- import { type DisplayFieldsProps, type User } from '../../types.js';
1
+ import { type DisplayFieldsProps, type User } from '#nuxt-users/types';
2
2
  interface Props extends DisplayFieldsProps {
3
3
  user: User;
4
4
  index: number;
@@ -1,4 +1,4 @@
1
- import type { User } from '../../types.js';
1
+ import type { User } from '#nuxt-users/types';
2
2
  type __VLS_Props = {
3
3
  user?: User | null;
4
4
  };
@@ -1,4 +1,4 @@
1
- import type { User, UserWithoutPassword } from '../../types.js';
1
+ import type { User, UserWithoutPassword } from '#nuxt-users/types';
2
2
  export declare const useAuthentication: () => {
3
3
  user: Readonly<import("vue").Ref<{
4
4
  readonly id: number;
@@ -1,5 +1,5 @@
1
1
  import { type PasswordValidationResult, type PasswordValidationOptions } from '../../utils/index.js';
2
- import type { RuntimeModuleOptions } from '../../types.js';
2
+ import type { RuntimeModuleOptions } from '#nuxt-users/types';
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,4 +1,4 @@
1
1
  declare const _default: import("h3").EventHandler<import("h3").EventHandlerRequest, Promise<{
2
- user: import("../../../../types.js").UserWithoutPassword;
2
+ user: import("#nuxt-users/types").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: import("../../../../types.js").UserWithoutPassword;
2
+ user: import("#nuxt-users/types").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("../../../../types.js").User, "password">;
2
+ user: Omit<import("#nuxt-users/types").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("../../../../types.js").UserWithoutPassword;
2
+ user: import("#nuxt-users/types").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: import("../../../../types.js").UserWithoutPassword;
2
+ user: import("#nuxt-users/types").UserWithoutPassword;
3
3
  }>>;
4
4
  export default _default;
@@ -8,8 +8,8 @@ export declare const useNuxtUsersDatabase: () => Promise<{
8
8
  passwordResetTokens: string;
9
9
  };
10
10
  connector: {
11
- name: import("../../../types.js").DatabaseType;
12
- options: import("../../../types.js").DatabaseConfig;
11
+ name: import("#nuxt-users/types").DatabaseType;
12
+ options: import("#nuxt-users/types").DatabaseConfig;
13
13
  };
14
14
  };
15
15
  }>;
@@ -1,4 +1,4 @@
1
- import type { UserWithoutPassword } from '../../../types.js';
1
+ import type { UserWithoutPassword } from '#nuxt-users/types';
2
2
  /**
3
3
  * Server-side composable for authentication utilities
4
4
  *
@@ -1,4 +1,4 @@
1
- import type { ModuleOptions } from '../../../types.js';
1
+ import type { ModuleOptions } from '#nuxt-users/types';
2
2
  /**
3
3
  * Generates a password reset link and sends it to the user's email.
4
4
  */
@@ -1,2 +1,2 @@
1
- import type { ModuleOptions } from '../../../types.js';
1
+ import type { ModuleOptions } from '#nuxt-users/types';
2
2
  export declare const addActiveToUsers: (options: ModuleOptions) => Promise<void>;
@@ -1,2 +1,2 @@
1
- import type { ModuleOptions } from '../../../types.js';
1
+ import type { ModuleOptions } from '#nuxt-users/types';
2
2
  export declare const createMigrationsTable: (options: ModuleOptions) => Promise<void>;
@@ -1,2 +1,2 @@
1
- import type { ModuleOptions } from '../../../types.js';
1
+ import type { ModuleOptions } from '#nuxt-users/types';
2
2
  export declare const createPasswordResetTokensTable: (options: ModuleOptions) => Promise<void>;
@@ -1,2 +1,2 @@
1
- import type { ModuleOptions } from '../../../types.js';
1
+ import type { ModuleOptions } from '#nuxt-users/types';
2
2
  export declare const createPersonalAccessTokensTable: (options: ModuleOptions) => Promise<void>;
@@ -1,2 +1,2 @@
1
- import type { ModuleOptions } from '../../../types.js';
1
+ import type { ModuleOptions } from '#nuxt-users/types';
2
2
  export declare const createUsersTable: (options: ModuleOptions) => Promise<void>;
@@ -1,4 +1,4 @@
1
- import type { ModuleOptions } from '../../../types.js';
1
+ import type { ModuleOptions } from '#nuxt-users/types';
2
2
  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
3
  export declare const useDb: (options: ModuleOptions) => Promise<import("db0").Database<import("db0").Connector<Database.Database>>>;
4
4
  export declare const checkTableExists: (options: ModuleOptions, tableName: string) => Promise<boolean>;
@@ -1,4 +1,4 @@
1
- import type { ModuleOptions } from '../../../types.js';
1
+ import type { ModuleOptions } from '#nuxt-users/types';
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 '../../../types.js';
1
+ import type { ModuleOptions, User, UserWithoutPassword } from '#nuxt-users/types';
2
2
  interface CreateUserParams {
3
3
  email: string;
4
4
  name: string;
@@ -1,4 +1,4 @@
1
- import type { Permission } from '../../types.js';
1
+ import type { Permission } from '#nuxt-users/types';
2
2
  /**
3
3
  * Checks if a path matches a pattern (supports wildcards)
4
4
  * @param path - The path to check
@@ -176,5 +176,30 @@ interface LoginFormData {
176
176
  password: string;
177
177
  rememberMe?: boolean;
178
178
  }
179
+ interface LoginFormProps {
180
+ apiEndpoint?: string;
181
+ redirectTo?: string;
182
+ forgotPasswordEndpoint?: string;
183
+ }
184
+ interface ResetPasswordFormProps {
185
+ apiEndpoint?: string;
186
+ updatePasswordEndpoint?: string;
187
+ }
188
+ interface DisplayFieldsProps {
189
+ displayFields?: string[];
190
+ fieldLabels?: Record<string, string>;
191
+ }
192
+ declare const defaultDisplayFields: string[];
193
+ declare const defaultFieldLabels: {
194
+ id: string;
195
+ name: string;
196
+ email: string;
197
+ role: string;
198
+ active: string;
199
+ created_at: string;
200
+ updated_at: string;
201
+ last_login_at: string;
202
+ };
179
203
 
180
- export type { LoginFormData as L, ModuleOptions as M, PersonalAccessToken as P, RuntimeModuleOptions as R, User as U, UserWithoutPassword as a, PasswordResetToken as b };
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 };
@@ -176,5 +176,30 @@ interface LoginFormData {
176
176
  password: string;
177
177
  rememberMe?: boolean;
178
178
  }
179
+ interface LoginFormProps {
180
+ apiEndpoint?: string;
181
+ redirectTo?: string;
182
+ forgotPasswordEndpoint?: string;
183
+ }
184
+ interface ResetPasswordFormProps {
185
+ apiEndpoint?: string;
186
+ updatePasswordEndpoint?: string;
187
+ }
188
+ interface DisplayFieldsProps {
189
+ displayFields?: string[];
190
+ fieldLabels?: Record<string, string>;
191
+ }
192
+ declare const defaultDisplayFields: string[];
193
+ declare const defaultFieldLabels: {
194
+ id: string;
195
+ name: string;
196
+ email: string;
197
+ role: string;
198
+ active: string;
199
+ created_at: string;
200
+ updated_at: string;
201
+ last_login_at: string;
202
+ };
179
203
 
180
- export type { LoginFormData as L, ModuleOptions as M, PersonalAccessToken as P, RuntimeModuleOptions as R, User as U, UserWithoutPassword as a, PasswordResetToken as b };
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 };
@@ -0,0 +1,162 @@
1
+ const DEFAULT_OPTIONS = {
2
+ minLength: 8,
3
+ requireUppercase: true,
4
+ requireLowercase: true,
5
+ requireNumbers: true,
6
+ requireSpecialChars: true,
7
+ preventCommonPasswords: true
8
+ };
9
+ const getPasswordValidationOptions = (moduleOptions) => {
10
+ if (!moduleOptions?.passwordValidation) {
11
+ return DEFAULT_OPTIONS;
12
+ }
13
+ return {
14
+ ...DEFAULT_OPTIONS,
15
+ ...moduleOptions.passwordValidation
16
+ };
17
+ };
18
+ const COMMON_PASSWORDS = [
19
+ "password",
20
+ "123456",
21
+ "123456789",
22
+ "qwerty",
23
+ "abc123",
24
+ "password123",
25
+ "admin",
26
+ "letmein",
27
+ "welcome",
28
+ "monkey",
29
+ "dragon",
30
+ "master",
31
+ "hello",
32
+ "freedom",
33
+ "whatever",
34
+ "qazwsx",
35
+ "trustno1",
36
+ "jordan",
37
+ "harley",
38
+ "ranger",
39
+ "buster",
40
+ "thomas",
41
+ "tigger",
42
+ "robert",
43
+ "soccer",
44
+ "batman",
45
+ "test",
46
+ "pass",
47
+ "user",
48
+ "guest",
49
+ "login",
50
+ "secret",
51
+ "god",
52
+ "love",
53
+ "sex",
54
+ "money",
55
+ "password1",
56
+ "12345678",
57
+ "qwerty123",
58
+ "admin123",
59
+ "password!",
60
+ "password1!",
61
+ "password123",
62
+ "password123!"
63
+ ];
64
+ const validatePassword = (password, options = {}) => {
65
+ const config = { ...DEFAULT_OPTIONS, ...options };
66
+ const errors = [];
67
+ const hints = [];
68
+ let score = 0;
69
+ if (password.length < config.minLength) {
70
+ errors.push(`Password must be at least ${config.minLength} characters long`);
71
+ hints.push(`Use at least ${config.minLength} characters`);
72
+ } else {
73
+ score += 20;
74
+ if (password.length < 12) {
75
+ hints.push("Use 12 or more characters for extra security");
76
+ }
77
+ }
78
+ if (config.requireUppercase && !/[A-Z]/.test(password)) {
79
+ errors.push("Password must contain at least one uppercase letter");
80
+ hints.push("Add an uppercase letter (A-Z)");
81
+ } else if (/[A-Z]/.test(password)) {
82
+ score += 15;
83
+ }
84
+ if (config.requireLowercase && !/[a-z]/.test(password)) {
85
+ errors.push("Password must contain at least one lowercase letter");
86
+ hints.push("Add a lowercase letter (a-z)");
87
+ } else if (/[a-z]/.test(password)) {
88
+ score += 15;
89
+ }
90
+ if (config.requireNumbers && !/\d/.test(password)) {
91
+ errors.push("Password must contain at least one number");
92
+ hints.push("Add a number (0-9)");
93
+ } else if (/\d/.test(password)) {
94
+ score += 15;
95
+ }
96
+ if (config.requireSpecialChars && !/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password)) {
97
+ errors.push("Password must contain at least one special character");
98
+ hints.push("Add a special character (e.g. !@#$%)");
99
+ } else if (/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password)) {
100
+ score += 15;
101
+ }
102
+ if (config.preventCommonPasswords && COMMON_PASSWORDS.includes(password.toLowerCase())) {
103
+ errors.push("Password is too common. Please choose a more unique password");
104
+ hints.push("Avoid common passwords or names");
105
+ }
106
+ if (password.length >= 12) {
107
+ score += 10;
108
+ } else if (password.length >= 10) {
109
+ score += 5;
110
+ }
111
+ const hasUppercase = /[A-Z]/.test(password);
112
+ const hasLowercase = /[a-z]/.test(password);
113
+ const hasNumbers = /\d/.test(password);
114
+ const hasSpecial = /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password);
115
+ const complexityTypes = [hasUppercase, hasLowercase, hasNumbers, hasSpecial].filter(Boolean).length;
116
+ if (complexityTypes >= 4) {
117
+ score += 10;
118
+ } else if (complexityTypes >= 3) {
119
+ score += 5;
120
+ hints.push("Use a mix of uppercase, lowercase, numbers, and special characters");
121
+ }
122
+ let strength = "weak";
123
+ if (score >= 80) {
124
+ strength = "strong";
125
+ } else if (score >= 60) {
126
+ strength = "medium";
127
+ }
128
+ return {
129
+ isValid: errors.length === 0,
130
+ errors,
131
+ strength,
132
+ score: Math.min(score, 100),
133
+ hints: Array.from(new Set(hints))
134
+ // deduplicate
135
+ };
136
+ };
137
+ const getPasswordStrengthColor = (strength) => {
138
+ switch (strength) {
139
+ case "weak":
140
+ return "#dc3545";
141
+ case "medium":
142
+ return "#ffc107";
143
+ case "strong":
144
+ return "#28a745";
145
+ default:
146
+ return "#6c757d";
147
+ }
148
+ };
149
+ const getPasswordStrengthText = (strength) => {
150
+ switch (strength) {
151
+ case "weak":
152
+ return "Weak";
153
+ case "medium":
154
+ return "Medium";
155
+ case "strong":
156
+ return "Strong";
157
+ default:
158
+ return "Unknown";
159
+ }
160
+ };
161
+
162
+ export { getPasswordStrengthColor as a, getPasswordStrengthText as b, getPasswordValidationOptions as g, validatePassword as v };
package/dist/utils.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { L as LoginFormData, M as ModuleOptions, b as PasswordResetToken, P as PersonalAccessToken, U as User, a as UserWithoutPassword } from './shared/nuxt-users.CAfpTSaE.mjs';
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';
2
2
 
3
3
  interface PasswordValidationResult {
4
4
  isValid: boolean;
package/dist/utils.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { L as LoginFormData, M as ModuleOptions, b as PasswordResetToken, P as PersonalAccessToken, U as User, a as UserWithoutPassword } from './shared/nuxt-users.CAfpTSaE.js';
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';
2
2
 
3
3
  interface PasswordValidationResult {
4
4
  isValid: boolean;
package/dist/utils.mjs CHANGED
@@ -1,162 +1,15 @@
1
- const DEFAULT_OPTIONS = {
2
- minLength: 8,
3
- requireUppercase: true,
4
- requireLowercase: true,
5
- requireNumbers: true,
6
- requireSpecialChars: true,
7
- preventCommonPasswords: true
8
- };
9
- const getPasswordValidationOptions = (moduleOptions) => {
10
- if (!moduleOptions?.passwordValidation) {
11
- return DEFAULT_OPTIONS;
12
- }
13
- return {
14
- ...DEFAULT_OPTIONS,
15
- ...moduleOptions.passwordValidation
16
- };
17
- };
18
- const COMMON_PASSWORDS = [
19
- "password",
20
- "123456",
21
- "123456789",
22
- "qwerty",
23
- "abc123",
24
- "password123",
25
- "admin",
26
- "letmein",
27
- "welcome",
28
- "monkey",
29
- "dragon",
30
- "master",
31
- "hello",
32
- "freedom",
33
- "whatever",
34
- "qazwsx",
35
- "trustno1",
36
- "jordan",
37
- "harley",
38
- "ranger",
39
- "buster",
40
- "thomas",
41
- "tigger",
42
- "robert",
43
- "soccer",
44
- "batman",
45
- "test",
46
- "pass",
47
- "user",
48
- "guest",
49
- "login",
50
- "secret",
51
- "god",
52
- "love",
53
- "sex",
54
- "money",
55
- "password1",
56
- "12345678",
57
- "qwerty123",
58
- "admin123",
59
- "password!",
60
- "password1!",
61
- "password123",
62
- "password123!"
63
- ];
64
- const validatePassword = (password, options = {}) => {
65
- const config = { ...DEFAULT_OPTIONS, ...options };
66
- const errors = [];
67
- const hints = [];
68
- let score = 0;
69
- if (password.length < config.minLength) {
70
- errors.push(`Password must be at least ${config.minLength} characters long`);
71
- hints.push(`Use at least ${config.minLength} characters`);
72
- } else {
73
- score += 20;
74
- if (password.length < 12) {
75
- hints.push("Use 12 or more characters for extra security");
76
- }
77
- }
78
- if (config.requireUppercase && !/[A-Z]/.test(password)) {
79
- errors.push("Password must contain at least one uppercase letter");
80
- hints.push("Add an uppercase letter (A-Z)");
81
- } else if (/[A-Z]/.test(password)) {
82
- score += 15;
83
- }
84
- if (config.requireLowercase && !/[a-z]/.test(password)) {
85
- errors.push("Password must contain at least one lowercase letter");
86
- hints.push("Add a lowercase letter (a-z)");
87
- } else if (/[a-z]/.test(password)) {
88
- score += 15;
89
- }
90
- if (config.requireNumbers && !/\d/.test(password)) {
91
- errors.push("Password must contain at least one number");
92
- hints.push("Add a number (0-9)");
93
- } else if (/\d/.test(password)) {
94
- score += 15;
95
- }
96
- if (config.requireSpecialChars && !/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password)) {
97
- errors.push("Password must contain at least one special character");
98
- hints.push("Add a special character (e.g. !@#$%)");
99
- } else if (/[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password)) {
100
- score += 15;
101
- }
102
- if (config.preventCommonPasswords && COMMON_PASSWORDS.includes(password.toLowerCase())) {
103
- errors.push("Password is too common. Please choose a more unique password");
104
- hints.push("Avoid common passwords or names");
105
- }
106
- if (password.length >= 12) {
107
- score += 10;
108
- } else if (password.length >= 10) {
109
- score += 5;
110
- }
111
- const hasUppercase = /[A-Z]/.test(password);
112
- const hasLowercase = /[a-z]/.test(password);
113
- const hasNumbers = /\d/.test(password);
114
- const hasSpecial = /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(password);
115
- const complexityTypes = [hasUppercase, hasLowercase, hasNumbers, hasSpecial].filter(Boolean).length;
116
- if (complexityTypes >= 4) {
117
- score += 10;
118
- } else if (complexityTypes >= 3) {
119
- score += 5;
120
- hints.push("Use a mix of uppercase, lowercase, numbers, and special characters");
121
- }
122
- let strength = "weak";
123
- if (score >= 80) {
124
- strength = "strong";
125
- } else if (score >= 60) {
126
- strength = "medium";
127
- }
128
- return {
129
- isValid: errors.length === 0,
130
- errors,
131
- strength,
132
- score: Math.min(score, 100),
133
- hints: Array.from(new Set(hints))
134
- // deduplicate
135
- };
136
- };
137
- const getPasswordStrengthColor = (strength) => {
138
- switch (strength) {
139
- case "weak":
140
- return "#dc3545";
141
- case "medium":
142
- return "#ffc107";
143
- case "strong":
144
- return "#28a745";
145
- default:
146
- return "#6c757d";
147
- }
148
- };
149
- const getPasswordStrengthText = (strength) => {
150
- switch (strength) {
151
- case "weak":
152
- return "Weak";
153
- case "medium":
154
- return "Medium";
155
- case "strong":
156
- return "Strong";
157
- default:
158
- return "Unknown";
159
- }
1
+ export { a as getPasswordStrengthColor, b as getPasswordStrengthText, g as getPasswordValidationOptions, v as validatePassword } from './shared/nuxt-users.BnOQs2LI.mjs';
2
+
3
+ const defaultDisplayFields = ["id", "name", "email", "role", "active", "created_at", "updated_at", "last_login_at"];
4
+ const defaultFieldLabels = {
5
+ id: "ID",
6
+ name: "Name",
7
+ email: "Email",
8
+ role: "Role",
9
+ active: "Active",
10
+ created_at: "Created",
11
+ updated_at: "Updated",
12
+ last_login_at: "Last Login"
160
13
  };
161
14
 
162
- export { getPasswordStrengthColor, getPasswordStrengthText, getPasswordValidationOptions, validatePassword };
15
+ export { defaultDisplayFields, defaultFieldLabels };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nuxt-users",
3
- "version": "1.17.0",
3
+ "version": "1.17.2",
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",
@@ -53,16 +53,16 @@
53
53
  "nuxt-users": "./dist/cli.mjs"
54
54
  },
55
55
  "scripts": {
56
- "prepack": "nuxt-module-build build && node scripts/post-build.js",
56
+ "prepack": "node scripts/replace-version.js && nuxt-module-build build && node scripts/post-build.js",
57
57
  "postinstall": "node -e \"try { require('fs').chmodSync('./dist/cli.mjs', '755') } catch(e) {}\"",
58
58
  "predev": "node -v | grep -q 'v22' || (echo 'Please use Node.js v22 for development' && exit 1)",
59
59
  "dev": "yarn dev:prepare && nuxi dev playground",
60
60
  "dev:build": "nuxi build playground",
61
61
  "dev:prepare": "yarn nuxt-module-build build --stub && yarn nuxt-module-build prepare && nuxi prepare playground",
62
- "build": "node scripts/replace-version.js && nuxt-module-build build",
62
+ "build": "nuxt-module-build build",
63
63
  "postbuild": "node scripts/post-build.js",
64
64
  "prerelease": "node -v | grep -q 'v22' || (echo 'Please use Node.js v22 for deployment' && exit 1)",
65
- "release": "yarn lint && yarn test && yarn build && changelogen --release && yarn publish && git push --follow-tags",
65
+ "release": "yarn lint && yarn test && changelogen --release && yarn build && yarn publish && git push --follow-tags",
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)",