nuxt-users 1.37.2 → 1.37.3
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/dist/module.json +1 -1
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/NUsersLoginForm.d.vue.ts +2 -2
- package/dist/runtime/components/NUsersLoginForm.vue.d.ts +2 -2
- package/dist/runtime/components/NUsersLogoutLink.d.vue.ts +2 -2
- package/dist/runtime/components/NUsersLogoutLink.vue.d.ts +2 -2
- package/dist/runtime/components/NUsersRegisterForm.d.vue.ts +9 -9
- package/dist/runtime/components/NUsersRegisterForm.vue.d.ts +9 -9
- package/dist/runtime/components/NUsersResetPasswordForm.d.vue.ts +2 -2
- package/dist/runtime/components/NUsersResetPasswordForm.vue.d.ts +2 -2
- package/dist/runtime/components/NUsersUserCard.d.vue.ts +3 -3
- package/dist/runtime/components/NUsersUserCard.vue.d.ts +3 -3
- package/dist/runtime/composables/useAuthentication.js +32 -18
- package/dist/runtime/plugin.client.d.ts +2 -0
- package/dist/runtime/plugin.client.js +6 -0
- package/package.json +1 -1
- package/.vscode/settings.json +0 -18
- package/CHANGELOG.md +0 -1981
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -52,7 +52,7 @@ const defaultOptions = {
|
|
|
52
52
|
},
|
|
53
53
|
hardDelete: false
|
|
54
54
|
};
|
|
55
|
-
const module = defineNuxtModule({
|
|
55
|
+
const module$1 = defineNuxtModule({
|
|
56
56
|
meta: {
|
|
57
57
|
name: "nuxt-users",
|
|
58
58
|
configKey: "nuxtUsers"
|
|
@@ -266,4 +266,4 @@ const module = defineNuxtModule({
|
|
|
266
266
|
}
|
|
267
267
|
});
|
|
268
268
|
|
|
269
|
-
export { module as default, defaultOptions };
|
|
269
|
+
export { module$1 as default, defaultOptions };
|
|
@@ -26,14 +26,14 @@ type __VLS_Slots = {} & {
|
|
|
26
26
|
'error-message'?: (props: typeof __VLS_15) => any;
|
|
27
27
|
};
|
|
28
28
|
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
29
|
-
error: (error: string) => any;
|
|
30
29
|
success: (user: UserWithoutPassword, rememberMe: boolean) => any;
|
|
30
|
+
error: (error: string) => any;
|
|
31
31
|
submit: (data: LoginFormData) => any;
|
|
32
32
|
"forgot-password-error": (error: string) => any;
|
|
33
33
|
"forgot-password-success": () => any;
|
|
34
34
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
35
|
-
onError?: ((error: string) => any) | undefined;
|
|
36
35
|
onSuccess?: ((user: UserWithoutPassword, rememberMe: boolean) => any) | undefined;
|
|
36
|
+
onError?: ((error: string) => any) | undefined;
|
|
37
37
|
onSubmit?: ((data: LoginFormData) => any) | undefined;
|
|
38
38
|
"onForgot-password-error"?: ((error: string) => any) | undefined;
|
|
39
39
|
"onForgot-password-success"?: (() => any) | undefined;
|
|
@@ -26,14 +26,14 @@ type __VLS_Slots = {} & {
|
|
|
26
26
|
'error-message'?: (props: typeof __VLS_15) => any;
|
|
27
27
|
};
|
|
28
28
|
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
29
|
-
error: (error: string) => any;
|
|
30
29
|
success: (user: UserWithoutPassword, rememberMe: boolean) => any;
|
|
30
|
+
error: (error: string) => any;
|
|
31
31
|
submit: (data: LoginFormData) => any;
|
|
32
32
|
"forgot-password-error": (error: string) => any;
|
|
33
33
|
"forgot-password-success": () => any;
|
|
34
34
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
35
|
-
onError?: ((error: string) => any) | undefined;
|
|
36
35
|
onSuccess?: ((user: UserWithoutPassword, rememberMe: boolean) => any) | undefined;
|
|
36
|
+
onError?: ((error: string) => any) | undefined;
|
|
37
37
|
onSubmit?: ((data: LoginFormData) => any) | undefined;
|
|
38
38
|
"onForgot-password-error"?: ((error: string) => any) | undefined;
|
|
39
39
|
"onForgot-password-success"?: (() => any) | undefined;
|
|
@@ -16,12 +16,12 @@ type __VLS_Slots = {} & {
|
|
|
16
16
|
default?: (props: typeof __VLS_1) => any;
|
|
17
17
|
};
|
|
18
18
|
declare const __VLS_base: import("vue").DefineComponent<LogoutLinkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
19
|
-
error: (error: string) => any;
|
|
20
19
|
success: () => any;
|
|
20
|
+
error: (error: string) => any;
|
|
21
21
|
click: () => any;
|
|
22
22
|
}, string, import("vue").PublicProps, Readonly<LogoutLinkProps> & Readonly<{
|
|
23
|
-
onError?: ((error: string) => any) | undefined;
|
|
24
23
|
onSuccess?: (() => any) | undefined;
|
|
24
|
+
onError?: ((error: string) => any) | undefined;
|
|
25
25
|
onClick?: (() => any) | undefined;
|
|
26
26
|
}>, {
|
|
27
27
|
redirectTo: string;
|
|
@@ -16,12 +16,12 @@ type __VLS_Slots = {} & {
|
|
|
16
16
|
default?: (props: typeof __VLS_1) => any;
|
|
17
17
|
};
|
|
18
18
|
declare const __VLS_base: import("vue").DefineComponent<LogoutLinkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
19
|
-
error: (error: string) => any;
|
|
20
19
|
success: () => any;
|
|
20
|
+
error: (error: string) => any;
|
|
21
21
|
click: () => any;
|
|
22
22
|
}, string, import("vue").PublicProps, Readonly<LogoutLinkProps> & Readonly<{
|
|
23
|
-
onError?: ((error: string) => any) | undefined;
|
|
24
23
|
onSuccess?: (() => any) | undefined;
|
|
24
|
+
onError?: ((error: string) => any) | undefined;
|
|
25
25
|
onClick?: (() => any) | undefined;
|
|
26
26
|
}>, {
|
|
27
27
|
redirectTo: string;
|
|
@@ -10,9 +10,9 @@ interface RegistrationFormData {
|
|
|
10
10
|
password: string;
|
|
11
11
|
confirmPassword: string;
|
|
12
12
|
}
|
|
13
|
-
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {}, __VLS_9: {},
|
|
13
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {}, __VLS_9: {}, __VLS_17: {}, __VLS_19: {}, __VLS_21: {}, __VLS_23: {
|
|
14
14
|
message: string;
|
|
15
|
-
},
|
|
15
|
+
}, __VLS_25: {
|
|
16
16
|
error: string;
|
|
17
17
|
};
|
|
18
18
|
type __VLS_Slots = {} & {
|
|
@@ -26,29 +26,29 @@ type __VLS_Slots = {} & {
|
|
|
26
26
|
} & {
|
|
27
27
|
'password-strength'?: (props: typeof __VLS_9) => any;
|
|
28
28
|
} & {
|
|
29
|
-
'confirm-password-field'?: (props: typeof
|
|
29
|
+
'confirm-password-field'?: (props: typeof __VLS_17) => any;
|
|
30
30
|
} & {
|
|
31
|
-
'submit-button'?: (props: typeof
|
|
31
|
+
'submit-button'?: (props: typeof __VLS_19) => any;
|
|
32
32
|
} & {
|
|
33
|
-
footer?: (props: typeof
|
|
33
|
+
footer?: (props: typeof __VLS_21) => any;
|
|
34
34
|
} & {
|
|
35
|
-
'success-message'?: (props: typeof
|
|
35
|
+
'success-message'?: (props: typeof __VLS_23) => any;
|
|
36
36
|
} & {
|
|
37
|
-
'error-message'?: (props: typeof
|
|
37
|
+
'error-message'?: (props: typeof __VLS_25) => any;
|
|
38
38
|
};
|
|
39
39
|
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
40
|
-
error: (error: string) => any;
|
|
41
40
|
success: (data: {
|
|
42
41
|
user: Omit<UserWithoutPassword, "active">;
|
|
43
42
|
message: string;
|
|
44
43
|
}) => any;
|
|
44
|
+
error: (error: string) => any;
|
|
45
45
|
submit: (data: RegistrationFormData) => any;
|
|
46
46
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
47
|
-
onError?: ((error: string) => any) | undefined;
|
|
48
47
|
onSuccess?: ((data: {
|
|
49
48
|
user: Omit<UserWithoutPassword, "active">;
|
|
50
49
|
message: string;
|
|
51
50
|
}) => any) | undefined;
|
|
51
|
+
onError?: ((error: string) => any) | undefined;
|
|
52
52
|
onSubmit?: ((data: RegistrationFormData) => any) | undefined;
|
|
53
53
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
54
54
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -10,9 +10,9 @@ interface RegistrationFormData {
|
|
|
10
10
|
password: string;
|
|
11
11
|
confirmPassword: string;
|
|
12
12
|
}
|
|
13
|
-
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {}, __VLS_9: {},
|
|
13
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {}, __VLS_9: {}, __VLS_17: {}, __VLS_19: {}, __VLS_21: {}, __VLS_23: {
|
|
14
14
|
message: string;
|
|
15
|
-
},
|
|
15
|
+
}, __VLS_25: {
|
|
16
16
|
error: string;
|
|
17
17
|
};
|
|
18
18
|
type __VLS_Slots = {} & {
|
|
@@ -26,29 +26,29 @@ type __VLS_Slots = {} & {
|
|
|
26
26
|
} & {
|
|
27
27
|
'password-strength'?: (props: typeof __VLS_9) => any;
|
|
28
28
|
} & {
|
|
29
|
-
'confirm-password-field'?: (props: typeof
|
|
29
|
+
'confirm-password-field'?: (props: typeof __VLS_17) => any;
|
|
30
30
|
} & {
|
|
31
|
-
'submit-button'?: (props: typeof
|
|
31
|
+
'submit-button'?: (props: typeof __VLS_19) => any;
|
|
32
32
|
} & {
|
|
33
|
-
footer?: (props: typeof
|
|
33
|
+
footer?: (props: typeof __VLS_21) => any;
|
|
34
34
|
} & {
|
|
35
|
-
'success-message'?: (props: typeof
|
|
35
|
+
'success-message'?: (props: typeof __VLS_23) => any;
|
|
36
36
|
} & {
|
|
37
|
-
'error-message'?: (props: typeof
|
|
37
|
+
'error-message'?: (props: typeof __VLS_25) => any;
|
|
38
38
|
};
|
|
39
39
|
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
40
|
-
error: (error: string) => any;
|
|
41
40
|
success: (data: {
|
|
42
41
|
user: Omit<UserWithoutPassword, "active">;
|
|
43
42
|
message: string;
|
|
44
43
|
}) => any;
|
|
44
|
+
error: (error: string) => any;
|
|
45
45
|
submit: (data: RegistrationFormData) => any;
|
|
46
46
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
47
|
-
onError?: ((error: string) => any) | undefined;
|
|
48
47
|
onSuccess?: ((data: {
|
|
49
48
|
user: Omit<UserWithoutPassword, "active">;
|
|
50
49
|
message: string;
|
|
51
50
|
}) => any) | undefined;
|
|
51
|
+
onError?: ((error: string) => any) | undefined;
|
|
52
52
|
onSubmit?: ((data: RegistrationFormData) => any) | undefined;
|
|
53
53
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
54
54
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
@@ -4,13 +4,13 @@ interface Props {
|
|
|
4
4
|
redirectTo?: string;
|
|
5
5
|
}
|
|
6
6
|
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
7
|
-
error: (error: string) => any;
|
|
8
7
|
success: (user: UserWithoutPassword) => any;
|
|
8
|
+
error: (error: string) => any;
|
|
9
9
|
"password-error": (error: string) => any;
|
|
10
10
|
"password-updated": () => any;
|
|
11
11
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
12
|
-
onError?: ((error: string) => any) | undefined;
|
|
13
12
|
onSuccess?: ((user: UserWithoutPassword) => any) | undefined;
|
|
13
|
+
onError?: ((error: string) => any) | undefined;
|
|
14
14
|
"onPassword-error"?: ((error: string) => any) | undefined;
|
|
15
15
|
"onPassword-updated"?: (() => any) | undefined;
|
|
16
16
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -4,13 +4,13 @@ interface Props {
|
|
|
4
4
|
redirectTo?: string;
|
|
5
5
|
}
|
|
6
6
|
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
7
|
-
error: (error: string) => any;
|
|
8
7
|
success: (user: UserWithoutPassword) => any;
|
|
8
|
+
error: (error: string) => any;
|
|
9
9
|
"password-error": (error: string) => any;
|
|
10
10
|
"password-updated": () => any;
|
|
11
11
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
12
|
-
onError?: ((error: string) => any) | undefined;
|
|
13
12
|
onSuccess?: ((user: UserWithoutPassword) => any) | undefined;
|
|
13
|
+
onError?: ((error: string) => any) | undefined;
|
|
14
14
|
"onPassword-error"?: ((error: string) => any) | undefined;
|
|
15
15
|
"onPassword-updated"?: (() => any) | undefined;
|
|
16
16
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -6,16 +6,16 @@ interface Props {
|
|
|
6
6
|
fieldLabels?: Record<string, string>;
|
|
7
7
|
}
|
|
8
8
|
declare var __VLS_1: {
|
|
9
|
-
user:
|
|
9
|
+
user: any;
|
|
10
10
|
index: number;
|
|
11
11
|
}, __VLS_3: {
|
|
12
12
|
canEdit: any;
|
|
13
13
|
editUser: () => Promise<void>;
|
|
14
|
-
user:
|
|
14
|
+
user: any;
|
|
15
15
|
}, __VLS_5: {
|
|
16
16
|
canDelete: any;
|
|
17
17
|
deleteUser: () => Promise<void>;
|
|
18
|
-
user:
|
|
18
|
+
user: any;
|
|
19
19
|
};
|
|
20
20
|
type __VLS_Slots = {} & {
|
|
21
21
|
userCard?: (props: typeof __VLS_1) => any;
|
|
@@ -6,16 +6,16 @@ interface Props {
|
|
|
6
6
|
fieldLabels?: Record<string, string>;
|
|
7
7
|
}
|
|
8
8
|
declare var __VLS_1: {
|
|
9
|
-
user:
|
|
9
|
+
user: any;
|
|
10
10
|
index: number;
|
|
11
11
|
}, __VLS_3: {
|
|
12
12
|
canEdit: any;
|
|
13
13
|
editUser: () => Promise<void>;
|
|
14
|
-
user:
|
|
14
|
+
user: any;
|
|
15
15
|
}, __VLS_5: {
|
|
16
16
|
canDelete: any;
|
|
17
17
|
deleteUser: () => Promise<void>;
|
|
18
|
-
user:
|
|
18
|
+
user: any;
|
|
19
19
|
};
|
|
20
20
|
type __VLS_Slots = {} & {
|
|
21
21
|
userCard?: (props: typeof __VLS_1) => any;
|
|
@@ -14,9 +14,9 @@ export const useAuthentication = () => {
|
|
|
14
14
|
sessionStorage.removeItem("user");
|
|
15
15
|
if (rememberMe) {
|
|
16
16
|
localStorage.setItem("user", JSON.stringify(userWithoutPassword));
|
|
17
|
-
|
|
18
|
-
sessionStorage.setItem("user", JSON.stringify(userWithoutPassword));
|
|
17
|
+
return;
|
|
19
18
|
}
|
|
19
|
+
sessionStorage.setItem("user", JSON.stringify(userWithoutPassword));
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
const logout = async () => {
|
|
@@ -48,7 +48,8 @@ export const useAuthentication = () => {
|
|
|
48
48
|
throw new Error(error.value.message || "Failed to fetch user");
|
|
49
49
|
}
|
|
50
50
|
userData = data.value?.user || null;
|
|
51
|
-
}
|
|
51
|
+
}
|
|
52
|
+
if (!useSSR) {
|
|
52
53
|
const response = await $fetch(`${apiBasePath}/me`, {
|
|
53
54
|
method: "GET"
|
|
54
55
|
});
|
|
@@ -63,9 +64,11 @@ export const useAuthentication = () => {
|
|
|
63
64
|
const wasInSessionStorage = sessionStorage.getItem("user") !== null;
|
|
64
65
|
if (wasInLocalStorage) {
|
|
65
66
|
localStorage.setItem("user", JSON.stringify(userData));
|
|
66
|
-
}
|
|
67
|
+
}
|
|
68
|
+
if (wasInSessionStorage) {
|
|
67
69
|
sessionStorage.setItem("user", JSON.stringify(userData));
|
|
68
|
-
}
|
|
70
|
+
}
|
|
71
|
+
if (!wasInLocalStorage && !wasInSessionStorage) {
|
|
69
72
|
sessionStorage.setItem("user", JSON.stringify(userData));
|
|
70
73
|
}
|
|
71
74
|
}
|
|
@@ -84,24 +87,35 @@ export const useAuthentication = () => {
|
|
|
84
87
|
if (!import.meta.client) {
|
|
85
88
|
return;
|
|
86
89
|
}
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
90
|
+
if (initializationPromise) {
|
|
91
|
+
return initializationPromise;
|
|
92
|
+
}
|
|
93
|
+
initializationPromise = (async () => {
|
|
94
|
+
const storedUserLocal = localStorage.getItem("user");
|
|
95
|
+
const storedUserSession = sessionStorage.getItem("user");
|
|
96
|
+
const storedUser = storedUserLocal || storedUserSession;
|
|
97
|
+
if (storedUser) {
|
|
98
|
+
try {
|
|
99
|
+
user.value = JSON.parse(storedUser);
|
|
100
|
+
await fetchUser();
|
|
101
|
+
} catch (error) {
|
|
102
|
+
console.error("Failed to parse stored user:", error);
|
|
103
|
+
localStorage.removeItem("user");
|
|
104
|
+
sessionStorage.removeItem("user");
|
|
105
|
+
user.value = null;
|
|
106
|
+
}
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
91
109
|
try {
|
|
92
|
-
user.value = JSON.parse(storedUser);
|
|
93
110
|
await fetchUser();
|
|
94
|
-
} catch
|
|
95
|
-
console.error("Failed to parse stored user:", error);
|
|
96
|
-
localStorage.removeItem("user");
|
|
97
|
-
sessionStorage.removeItem("user");
|
|
98
|
-
user.value = null;
|
|
111
|
+
} catch {
|
|
99
112
|
}
|
|
100
|
-
}
|
|
113
|
+
})().catch((_error) => {
|
|
114
|
+
});
|
|
115
|
+
return initializationPromise;
|
|
101
116
|
};
|
|
102
117
|
if (import.meta.client && !initializationPromise) {
|
|
103
|
-
|
|
104
|
-
});
|
|
118
|
+
initializeUser();
|
|
105
119
|
}
|
|
106
120
|
return {
|
|
107
121
|
user: readonly(user),
|
package/package.json
CHANGED
package/.vscode/settings.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"eslint.experimental.useFlatConfig": true,
|
|
3
|
-
"editor.formatOnSave": true,
|
|
4
|
-
"editor.defaultFormatter": "dbaeumer.vscode-eslint",
|
|
5
|
-
"editor.codeActionsOnSave": {
|
|
6
|
-
"source.fixAll.eslint": "explicit"
|
|
7
|
-
},
|
|
8
|
-
"[javascript]": {
|
|
9
|
-
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
10
|
-
},
|
|
11
|
-
"[typescript]": {
|
|
12
|
-
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
13
|
-
},
|
|
14
|
-
"[vue]": {
|
|
15
|
-
"editor.defaultFormatter": "dbaeumer.vscode-eslint"
|
|
16
|
-
},
|
|
17
|
-
"eslint.validate": ["javascript", "typescript", "vue"]
|
|
18
|
-
}
|