nuxt-users 1.4.0 → 1.6.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.
- package/CHANGELOG.md +63 -0
- package/dist/cli.mjs +12 -30
- package/dist/module.d.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +37 -0
- package/dist/runtime/components/LoginForm.vue.d.ts +3 -3
- package/dist/runtime/components/PasswordStrengthIndicator.vue +132 -0
- package/dist/runtime/components/PasswordStrengthIndicator.vue.d.ts +12 -0
- package/dist/runtime/components/ProfileForm.vue +240 -0
- package/dist/runtime/components/ProfileForm.vue.d.ts +20 -0
- package/dist/runtime/components/ResetPasswordForm.vue +30 -4
- package/dist/runtime/composables/useAuth.d.ts +20 -2
- package/dist/runtime/composables/useAuth.js +53 -2
- package/dist/runtime/composables/usePasswordValidation.d.ts +33 -0
- package/dist/runtime/composables/usePasswordValidation.js +37 -0
- package/dist/runtime/plugin.js +29 -1
- package/dist/runtime/server/api/auth/reset-password.post.js +9 -3
- package/dist/runtime/server/api/profile.get.d.ts +11 -0
- package/dist/runtime/server/api/profile.get.js +23 -0
- package/dist/runtime/server/api/update-password.post.d.ts +4 -0
- package/dist/runtime/server/api/update-password.post.js +60 -0
- package/dist/shared/{nuxt-users.DZkU2AbH.mjs → nuxt-users.37k1R3_g.mjs} +172 -1
- package/dist/shared/{nuxt-users.DGRKT2Tq.d.mts → nuxt-users.CMEtv_Mw.d.mts} +64 -6
- package/dist/shared/{nuxt-users.DGRKT2Tq.d.ts → nuxt-users.CMEtv_Mw.d.ts} +64 -6
- package/dist/utils.d.mts +28 -2
- package/dist/utils.d.ts +28 -2
- package/dist/utils.mjs +1 -1
- package/package.json +4 -3
|
@@ -7,16 +7,16 @@ type DatabaseConfig = {
|
|
|
7
7
|
password?: string;
|
|
8
8
|
database?: string;
|
|
9
9
|
};
|
|
10
|
-
interface
|
|
10
|
+
interface RuntimeModuleOptions {
|
|
11
11
|
connector?: {
|
|
12
12
|
name: DatabaseType;
|
|
13
13
|
options: DatabaseConfig;
|
|
14
14
|
};
|
|
15
|
-
tables
|
|
16
|
-
migrations
|
|
17
|
-
users
|
|
18
|
-
personalAccessTokens
|
|
19
|
-
passwordResetTokens
|
|
15
|
+
tables?: {
|
|
16
|
+
migrations?: string;
|
|
17
|
+
users?: string;
|
|
18
|
+
personalAccessTokens?: string;
|
|
19
|
+
passwordResetTokens?: string;
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
22
|
* Mailer configuration options for sending emails (e.g., password resets)
|
|
@@ -38,8 +38,66 @@ interface ModuleOptions {
|
|
|
38
38
|
* @default ['/login']
|
|
39
39
|
* @example ['/login', '/register']
|
|
40
40
|
*/
|
|
41
|
+
whitelist?: string[];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Password validation configuration
|
|
45
|
+
*/
|
|
46
|
+
passwordValidation?: {
|
|
47
|
+
/**
|
|
48
|
+
* Minimum password length
|
|
49
|
+
* @default 8
|
|
50
|
+
*/
|
|
51
|
+
minLength?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Require uppercase letters
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
requireUppercase?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Require lowercase letters
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
requireLowercase?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Require numbers
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
requireNumbers?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Require special characters
|
|
69
|
+
* @default true
|
|
70
|
+
*/
|
|
71
|
+
requireSpecialChars?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Prevent common passwords
|
|
74
|
+
* @default true
|
|
75
|
+
*/
|
|
76
|
+
preventCommonPasswords?: boolean;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
interface ModuleOptions extends Omit<RuntimeModuleOptions, 'tables' | 'auth' | 'passwordValidation'> {
|
|
80
|
+
connector: {
|
|
81
|
+
name: DatabaseType;
|
|
82
|
+
options: DatabaseConfig;
|
|
83
|
+
};
|
|
84
|
+
tables: {
|
|
85
|
+
migrations: string;
|
|
86
|
+
users: string;
|
|
87
|
+
personalAccessTokens: string;
|
|
88
|
+
passwordResetTokens: string;
|
|
89
|
+
};
|
|
90
|
+
auth: {
|
|
41
91
|
whitelist: string[];
|
|
42
92
|
};
|
|
93
|
+
passwordValidation: {
|
|
94
|
+
minLength: number;
|
|
95
|
+
requireUppercase: boolean;
|
|
96
|
+
requireLowercase: boolean;
|
|
97
|
+
requireNumbers: boolean;
|
|
98
|
+
requireSpecialChars: boolean;
|
|
99
|
+
preventCommonPasswords: boolean;
|
|
100
|
+
};
|
|
43
101
|
}
|
|
44
102
|
interface MailerOptions {
|
|
45
103
|
host: string;
|
|
@@ -7,16 +7,16 @@ type DatabaseConfig = {
|
|
|
7
7
|
password?: string;
|
|
8
8
|
database?: string;
|
|
9
9
|
};
|
|
10
|
-
interface
|
|
10
|
+
interface RuntimeModuleOptions {
|
|
11
11
|
connector?: {
|
|
12
12
|
name: DatabaseType;
|
|
13
13
|
options: DatabaseConfig;
|
|
14
14
|
};
|
|
15
|
-
tables
|
|
16
|
-
migrations
|
|
17
|
-
users
|
|
18
|
-
personalAccessTokens
|
|
19
|
-
passwordResetTokens
|
|
15
|
+
tables?: {
|
|
16
|
+
migrations?: string;
|
|
17
|
+
users?: string;
|
|
18
|
+
personalAccessTokens?: string;
|
|
19
|
+
passwordResetTokens?: string;
|
|
20
20
|
};
|
|
21
21
|
/**
|
|
22
22
|
* Mailer configuration options for sending emails (e.g., password resets)
|
|
@@ -38,8 +38,66 @@ interface ModuleOptions {
|
|
|
38
38
|
* @default ['/login']
|
|
39
39
|
* @example ['/login', '/register']
|
|
40
40
|
*/
|
|
41
|
+
whitelist?: string[];
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Password validation configuration
|
|
45
|
+
*/
|
|
46
|
+
passwordValidation?: {
|
|
47
|
+
/**
|
|
48
|
+
* Minimum password length
|
|
49
|
+
* @default 8
|
|
50
|
+
*/
|
|
51
|
+
minLength?: number;
|
|
52
|
+
/**
|
|
53
|
+
* Require uppercase letters
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
requireUppercase?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Require lowercase letters
|
|
59
|
+
* @default true
|
|
60
|
+
*/
|
|
61
|
+
requireLowercase?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Require numbers
|
|
64
|
+
* @default true
|
|
65
|
+
*/
|
|
66
|
+
requireNumbers?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Require special characters
|
|
69
|
+
* @default true
|
|
70
|
+
*/
|
|
71
|
+
requireSpecialChars?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Prevent common passwords
|
|
74
|
+
* @default true
|
|
75
|
+
*/
|
|
76
|
+
preventCommonPasswords?: boolean;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
interface ModuleOptions extends Omit<RuntimeModuleOptions, 'tables' | 'auth' | 'passwordValidation'> {
|
|
80
|
+
connector: {
|
|
81
|
+
name: DatabaseType;
|
|
82
|
+
options: DatabaseConfig;
|
|
83
|
+
};
|
|
84
|
+
tables: {
|
|
85
|
+
migrations: string;
|
|
86
|
+
users: string;
|
|
87
|
+
personalAccessTokens: string;
|
|
88
|
+
passwordResetTokens: string;
|
|
89
|
+
};
|
|
90
|
+
auth: {
|
|
41
91
|
whitelist: string[];
|
|
42
92
|
};
|
|
93
|
+
passwordValidation: {
|
|
94
|
+
minLength: number;
|
|
95
|
+
requireUppercase: boolean;
|
|
96
|
+
requireLowercase: boolean;
|
|
97
|
+
requireNumbers: boolean;
|
|
98
|
+
requireSpecialChars: boolean;
|
|
99
|
+
preventCommonPasswords: boolean;
|
|
100
|
+
};
|
|
43
101
|
}
|
|
44
102
|
interface MailerOptions {
|
|
45
103
|
host: string;
|
package/dist/utils.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as db0 from 'db0';
|
|
2
|
-
import { M as ModuleOptions, U as User } from './shared/nuxt-users.
|
|
2
|
+
import { M as ModuleOptions, U as User } from './shared/nuxt-users.CMEtv_Mw.mjs';
|
|
3
3
|
|
|
4
4
|
declare const useDb: (options: ModuleOptions) => Promise<db0.Database<db0.Connector<Database.Database>>>;
|
|
5
5
|
declare const checkTableExists: (options: ModuleOptions, tableName: string) => Promise<boolean>;
|
|
@@ -35,4 +35,30 @@ declare const createMigrationsTable: (options: ModuleOptions) => Promise<void>;
|
|
|
35
35
|
|
|
36
36
|
declare const runMigrations: (options: ModuleOptions) => Promise<void>;
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
interface PasswordValidationResult {
|
|
39
|
+
isValid: boolean;
|
|
40
|
+
errors: string[];
|
|
41
|
+
strength: 'weak' | 'medium' | 'strong';
|
|
42
|
+
score: number;
|
|
43
|
+
hints: string[];
|
|
44
|
+
}
|
|
45
|
+
interface PasswordValidationOptions {
|
|
46
|
+
minLength?: number;
|
|
47
|
+
requireUppercase?: boolean;
|
|
48
|
+
requireLowercase?: boolean;
|
|
49
|
+
requireNumbers?: boolean;
|
|
50
|
+
requireSpecialChars?: boolean;
|
|
51
|
+
preventCommonPasswords?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get password validation options from module configuration
|
|
55
|
+
*/
|
|
56
|
+
declare const getPasswordValidationOptions: (moduleOptions?: {
|
|
57
|
+
passwordValidation?: PasswordValidationOptions;
|
|
58
|
+
}) => PasswordValidationOptions;
|
|
59
|
+
declare const validatePassword: (password: string, options?: PasswordValidationOptions) => PasswordValidationResult;
|
|
60
|
+
declare const getPasswordStrengthColor: (strength: "weak" | "medium" | "strong") => string;
|
|
61
|
+
declare const getPasswordStrengthText: (strength: "weak" | "medium" | "strong") => string;
|
|
62
|
+
|
|
63
|
+
export { checkTableExists, createMigrationsTable, createPasswordResetTokensTable, createPersonalAccessTokensTable, createUser, createUsersTable, findUserByEmail, getPasswordStrengthColor, getPasswordStrengthText, getPasswordValidationOptions, runMigrations, updateUserPassword, useDb, validatePassword };
|
|
64
|
+
export type { PasswordValidationOptions, PasswordValidationResult };
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as db0 from 'db0';
|
|
2
|
-
import { M as ModuleOptions, U as User } from './shared/nuxt-users.
|
|
2
|
+
import { M as ModuleOptions, U as User } from './shared/nuxt-users.CMEtv_Mw.js';
|
|
3
3
|
|
|
4
4
|
declare const useDb: (options: ModuleOptions) => Promise<db0.Database<db0.Connector<Database.Database>>>;
|
|
5
5
|
declare const checkTableExists: (options: ModuleOptions, tableName: string) => Promise<boolean>;
|
|
@@ -35,4 +35,30 @@ declare const createMigrationsTable: (options: ModuleOptions) => Promise<void>;
|
|
|
35
35
|
|
|
36
36
|
declare const runMigrations: (options: ModuleOptions) => Promise<void>;
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
interface PasswordValidationResult {
|
|
39
|
+
isValid: boolean;
|
|
40
|
+
errors: string[];
|
|
41
|
+
strength: 'weak' | 'medium' | 'strong';
|
|
42
|
+
score: number;
|
|
43
|
+
hints: string[];
|
|
44
|
+
}
|
|
45
|
+
interface PasswordValidationOptions {
|
|
46
|
+
minLength?: number;
|
|
47
|
+
requireUppercase?: boolean;
|
|
48
|
+
requireLowercase?: boolean;
|
|
49
|
+
requireNumbers?: boolean;
|
|
50
|
+
requireSpecialChars?: boolean;
|
|
51
|
+
preventCommonPasswords?: boolean;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get password validation options from module configuration
|
|
55
|
+
*/
|
|
56
|
+
declare const getPasswordValidationOptions: (moduleOptions?: {
|
|
57
|
+
passwordValidation?: PasswordValidationOptions;
|
|
58
|
+
}) => PasswordValidationOptions;
|
|
59
|
+
declare const validatePassword: (password: string, options?: PasswordValidationOptions) => PasswordValidationResult;
|
|
60
|
+
declare const getPasswordStrengthColor: (strength: "weak" | "medium" | "strong") => string;
|
|
61
|
+
declare const getPasswordStrengthText: (strength: "weak" | "medium" | "strong") => string;
|
|
62
|
+
|
|
63
|
+
export { checkTableExists, createMigrationsTable, createPasswordResetTokensTable, createPersonalAccessTokensTable, createUser, createUsersTable, findUserByEmail, getPasswordStrengthColor, getPasswordStrengthText, getPasswordValidationOptions, runMigrations, updateUserPassword, useDb, validatePassword };
|
|
64
|
+
export type { PasswordValidationOptions, PasswordValidationResult };
|
package/dist/utils.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { c as checkTableExists, h as createMigrationsTable, g as createPasswordResetTokensTable, e as createPersonalAccessTokensTable, a as createUser, d as createUsersTable, f as findUserByEmail, r as runMigrations, b as updateUserPassword, u as useDb } from './shared/nuxt-users.
|
|
1
|
+
export { c as checkTableExists, h as createMigrationsTable, g as createPasswordResetTokensTable, e as createPersonalAccessTokensTable, a as createUser, d as createUsersTable, f as findUserByEmail, j as getPasswordStrengthColor, k as getPasswordStrengthText, i as getPasswordValidationOptions, r as runMigrations, b as updateUserPassword, u as useDb, v as validatePassword } from './shared/nuxt-users.37k1R3_g.mjs';
|
|
2
2
|
import 'bcrypt';
|
|
3
3
|
import 'db0';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nuxt-users",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"description": "A comprehensive user management module for Nuxt 3 applications with authentication, database support, and CLI tools",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"nuxt",
|
|
@@ -64,8 +64,9 @@
|
|
|
64
64
|
"lint": "eslint .",
|
|
65
65
|
"lint:fix": "eslint . --fix",
|
|
66
66
|
"pretest": "node -v | grep -q 'v22' || (echo 'Please use Node.js v22 for testing' && exit 1)",
|
|
67
|
-
"test": "yarn test:types && yarn test:sqlite && yarn test:mysql && yarn test:postgresql",
|
|
67
|
+
"test": "yarn test:types && yarn test:unit && yarn test:sqlite && yarn test:mysql && yarn test:postgresql",
|
|
68
68
|
"test:watch": "vitest watch",
|
|
69
|
+
"test:unit": "./scripts/test-unit.sh",
|
|
69
70
|
"test:sqlite": "./scripts/test-sqlite.sh",
|
|
70
71
|
"test:mysql": "./scripts/test-mysql.sh",
|
|
71
72
|
"test:postgresql": "./scripts/test-postgresql.sh",
|
|
@@ -113,7 +114,7 @@
|
|
|
113
114
|
"eslint": "^9.30.1",
|
|
114
115
|
"nuxt": "^3.17.6",
|
|
115
116
|
"tsx": "^4.20.3",
|
|
116
|
-
"typescript": "~5.
|
|
117
|
+
"typescript": "~5.9.0",
|
|
117
118
|
"unbuild": "^3.0.0",
|
|
118
119
|
"vitepress": "^1.6.3",
|
|
119
120
|
"vitest": "^3.2.4",
|