nuxt-users 1.38.0 → 1.39.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/README.md +5 -1
- package/dist/cli.mjs +10 -6
- package/dist/module.d.mts +1 -1
- package/dist/module.d.ts +1 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +12 -3
- package/dist/runtime/components/NUsersEmailConfirmation.d.vue.ts +5 -3
- package/dist/runtime/components/NUsersEmailConfirmation.vue +22 -15
- package/dist/runtime/components/NUsersEmailConfirmation.vue.d.ts +5 -3
- package/dist/runtime/components/NUsersGoogleLoginButton.d.vue.ts +4 -2
- package/dist/runtime/components/NUsersGoogleLoginButton.vue +5 -2
- package/dist/runtime/components/NUsersGoogleLoginButton.vue.d.ts +4 -2
- package/dist/runtime/components/NUsersList.vue +25 -11
- package/dist/runtime/components/NUsersLoginForm.d.vue.ts +13 -2
- package/dist/runtime/components/NUsersLoginForm.vue +35 -13
- package/dist/runtime/components/NUsersLoginForm.vue.d.ts +13 -2
- package/dist/runtime/components/NUsersLogoutLink.d.vue.ts +3 -4
- package/dist/runtime/components/NUsersLogoutLink.vue +8 -5
- package/dist/runtime/components/NUsersLogoutLink.vue.d.ts +3 -4
- package/dist/runtime/components/NUsersPasswordStrengthIndicator.d.vue.ts +6 -0
- package/dist/runtime/components/NUsersPasswordStrengthIndicator.vue +17 -9
- package/dist/runtime/components/NUsersPasswordStrengthIndicator.vue.d.ts +6 -0
- package/dist/runtime/components/NUsersProfileInfo.d.vue.ts +13 -1
- package/dist/runtime/components/NUsersProfileInfo.vue +23 -9
- package/dist/runtime/components/NUsersProfileInfo.vue.d.ts +13 -1
- package/dist/runtime/components/NUsersRegisterForm.d.vue.ts +26 -11
- package/dist/runtime/components/NUsersRegisterForm.vue +34 -16
- package/dist/runtime/components/NUsersRegisterForm.vue.d.ts +26 -11
- package/dist/runtime/components/NUsersResetPasswordForm.d.vue.ts +11 -2
- package/dist/runtime/components/NUsersResetPasswordForm.vue +25 -12
- package/dist/runtime/components/NUsersResetPasswordForm.vue.d.ts +11 -2
- package/dist/runtime/components/NUsersUserCard.d.vue.ts +2 -0
- package/dist/runtime/components/NUsersUserCard.vue +8 -4
- package/dist/runtime/components/NUsersUserCard.vue.d.ts +2 -0
- package/dist/runtime/components/NUsersUserForm.d.vue.ts +2 -2
- package/dist/runtime/components/NUsersUserForm.vue +5 -4
- package/dist/runtime/components/NUsersUserForm.vue.d.ts +2 -2
- package/dist/runtime/composables/useNuxtUsersLocale.d.ts +15 -0
- package/dist/runtime/composables/useNuxtUsersLocale.js +27 -0
- package/dist/runtime/composables/usePasswordValidation.d.ts +1 -1
- package/dist/runtime/composables/usePublicPaths.js +2 -1
- package/dist/runtime/locales/en.d.ts +2 -0
- package/dist/runtime/locales/en.js +130 -0
- package/dist/runtime/locales/hu.d.ts +3 -0
- package/dist/runtime/locales/hu.js +188 -0
- package/dist/runtime/locales/index.d.ts +5 -0
- package/dist/runtime/locales/index.js +8 -0
- package/dist/runtime/server/api/nuxt-users/confirm-email.get.js +3 -3
- package/dist/runtime/server/api/nuxt-users/password/forgot.post.js +2 -1
- package/dist/runtime/server/api/nuxt-users/password/reset.post.d.ts +1 -1
- package/dist/runtime/server/api/nuxt-users/password/reset.post.js +4 -2
- package/dist/runtime/server/api/nuxt-users/session/index.post.js +4 -2
- package/dist/runtime/server/middleware/authorization.server.js +6 -3
- package/dist/runtime/server/utils/google-oauth.js +2 -1
- package/dist/runtime/utils/deep-merge.d.ts +8 -0
- package/dist/runtime/utils/deep-merge.js +17 -0
- package/dist/runtime/utils/locale.d.ts +14 -0
- package/dist/runtime/utils/locale.js +38 -0
- package/dist/shared/{nuxt-users.BnOQs2LI.mjs → nuxt-users.DfZ7bc_P.mjs} +16 -8
- package/dist/shared/{nuxt-users.SXaMnaEL.d.mts → nuxt-users.FiQjvlZl.d.mts} +40 -2
- package/dist/shared/{nuxt-users.SXaMnaEL.d.ts → nuxt-users.FiQjvlZl.d.ts} +40 -2
- package/dist/utils.d.mts +4 -1
- package/dist/utils.d.ts +4 -1
- package/dist/utils.mjs +4 -1
- package/package.json +5 -3
- package/scripts/check-locale-consistency.ts +156 -0
- package/scripts/check-peer-dependencies.js +5 -5
- package/scripts/check-translations.ts +255 -0
- package/scripts/post-build.js +1 -1
|
@@ -2,6 +2,17 @@ interface Props {
|
|
|
2
2
|
apiEndpoint?: string;
|
|
3
3
|
forgotPasswordEndpoint?: string;
|
|
4
4
|
redirectTo?: string;
|
|
5
|
+
title?: string;
|
|
6
|
+
subtitle?: string;
|
|
7
|
+
emailLabel?: string;
|
|
8
|
+
emailPlaceholder?: string;
|
|
9
|
+
passwordLabel?: string;
|
|
10
|
+
passwordPlaceholder?: string;
|
|
11
|
+
rememberMeLabel?: string;
|
|
12
|
+
submitLabel?: string;
|
|
13
|
+
submittingLabel?: string;
|
|
14
|
+
forgotPasswordLabel?: string;
|
|
15
|
+
forgotPasswordSendingLabel?: string;
|
|
5
16
|
}
|
|
6
17
|
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {}, __VLS_9: {}, __VLS_11: {}, __VLS_13: {
|
|
7
18
|
message: string;
|
|
@@ -26,15 +37,15 @@ type __VLS_Slots = {} & {
|
|
|
26
37
|
'error-message'?: (props: typeof __VLS_15) => any;
|
|
27
38
|
};
|
|
28
39
|
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
29
|
-
success: (user: UserWithoutPassword, rememberMe: boolean) => any;
|
|
30
40
|
error: (error: string) => any;
|
|
31
41
|
submit: (data: LoginFormData) => any;
|
|
42
|
+
success: (user: UserWithoutPassword, rememberMe: boolean) => any;
|
|
32
43
|
"forgot-password-error": (error: string) => any;
|
|
33
44
|
"forgot-password-success": () => any;
|
|
34
45
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
35
|
-
onSuccess?: ((user: UserWithoutPassword, rememberMe: boolean) => any) | undefined;
|
|
36
46
|
onError?: ((error: string) => any) | undefined;
|
|
37
47
|
onSubmit?: ((data: LoginFormData) => any) | undefined;
|
|
48
|
+
onSuccess?: ((user: UserWithoutPassword, rememberMe: boolean) => any) | undefined;
|
|
38
49
|
"onForgot-password-error"?: ((error: string) => any) | undefined;
|
|
39
50
|
"onForgot-password-success"?: (() => any) | undefined;
|
|
40
51
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -2,6 +2,7 @@ interface LogoutLinkProps {
|
|
|
2
2
|
redirectTo?: string;
|
|
3
3
|
linkText?: string;
|
|
4
4
|
confirmMessage?: string;
|
|
5
|
+
loggingOutText?: string;
|
|
5
6
|
class?: string;
|
|
6
7
|
style?: string | Record<string, string | number>;
|
|
7
8
|
linkClass?: string;
|
|
@@ -16,17 +17,15 @@ type __VLS_Slots = {} & {
|
|
|
16
17
|
default?: (props: typeof __VLS_1) => any;
|
|
17
18
|
};
|
|
18
19
|
declare const __VLS_base: import("vue").DefineComponent<LogoutLinkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
19
|
-
success: () => any;
|
|
20
20
|
error: (error: string) => any;
|
|
21
|
+
success: () => any;
|
|
21
22
|
click: () => any;
|
|
22
23
|
}, string, import("vue").PublicProps, Readonly<LogoutLinkProps> & Readonly<{
|
|
23
|
-
onSuccess?: (() => any) | undefined;
|
|
24
24
|
onError?: ((error: string) => any) | undefined;
|
|
25
|
+
onSuccess?: (() => any) | undefined;
|
|
25
26
|
onClick?: (() => any) | undefined;
|
|
26
27
|
}>, {
|
|
27
28
|
redirectTo: string;
|
|
28
|
-
linkText: string;
|
|
29
|
-
confirmMessage: string;
|
|
30
29
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
31
30
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
32
31
|
declare const _default: typeof __VLS_export;
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
import { ref, onMounted } from "vue";
|
|
3
3
|
import { navigateTo } from "#app";
|
|
4
4
|
import { useAuthentication } from "../composables/useAuthentication";
|
|
5
|
+
import { useNuxtUsersLocale } from "../composables/useNuxtUsersLocale";
|
|
6
|
+
const { t } = useNuxtUsersLocale();
|
|
5
7
|
const props = defineProps({
|
|
6
8
|
redirectTo: { type: String, required: false, default: "/login" },
|
|
7
|
-
linkText: { type: String, required: false
|
|
8
|
-
confirmMessage: { type: String, required: false
|
|
9
|
+
linkText: { type: String, required: false },
|
|
10
|
+
confirmMessage: { type: String, required: false },
|
|
11
|
+
loggingOutText: { type: String, required: false },
|
|
9
12
|
class: { type: String, required: false },
|
|
10
13
|
style: { type: [String, Object], required: false },
|
|
11
14
|
linkClass: { type: String, required: false },
|
|
@@ -24,7 +27,7 @@ onMounted(() => {
|
|
|
24
27
|
});
|
|
25
28
|
const handleLogout = async (event) => {
|
|
26
29
|
event.preventDefault();
|
|
27
|
-
if (!confirm(props.confirmMessage)) {
|
|
30
|
+
if (!confirm(props.confirmMessage || t("logout.confirmMessage"))) {
|
|
28
31
|
return;
|
|
29
32
|
}
|
|
30
33
|
if (!authComposable) {
|
|
@@ -71,8 +74,8 @@ const handleLogout = async (event) => {
|
|
|
71
74
|
@click="handleLogout"
|
|
72
75
|
>
|
|
73
76
|
<slot>
|
|
74
|
-
<span v-if="isLoading">
|
|
75
|
-
<span v-
|
|
77
|
+
<span v-if="isLoading">{{ props.loggingOutText || t("logout.loggingOut") }}</span>
|
|
78
|
+
<span v-if="!isLoading">{{ props.linkText || t("logout.linkText") }}</span>
|
|
76
79
|
</slot>
|
|
77
80
|
</a>
|
|
78
81
|
</div>
|
|
@@ -2,6 +2,7 @@ interface LogoutLinkProps {
|
|
|
2
2
|
redirectTo?: string;
|
|
3
3
|
linkText?: string;
|
|
4
4
|
confirmMessage?: string;
|
|
5
|
+
loggingOutText?: string;
|
|
5
6
|
class?: string;
|
|
6
7
|
style?: string | Record<string, string | number>;
|
|
7
8
|
linkClass?: string;
|
|
@@ -16,17 +17,15 @@ type __VLS_Slots = {} & {
|
|
|
16
17
|
default?: (props: typeof __VLS_1) => any;
|
|
17
18
|
};
|
|
18
19
|
declare const __VLS_base: import("vue").DefineComponent<LogoutLinkProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
19
|
-
success: () => any;
|
|
20
20
|
error: (error: string) => any;
|
|
21
|
+
success: () => any;
|
|
21
22
|
click: () => any;
|
|
22
23
|
}, string, import("vue").PublicProps, Readonly<LogoutLinkProps> & Readonly<{
|
|
23
|
-
onSuccess?: (() => any) | undefined;
|
|
24
24
|
onError?: ((error: string) => any) | undefined;
|
|
25
|
+
onSuccess?: (() => any) | undefined;
|
|
25
26
|
onClick?: (() => any) | undefined;
|
|
26
27
|
}>, {
|
|
27
28
|
redirectTo: string;
|
|
28
|
-
linkText: string;
|
|
29
|
-
confirmMessage: string;
|
|
30
29
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
31
30
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
32
31
|
declare const _default: typeof __VLS_export;
|
|
@@ -4,6 +4,12 @@ interface Props {
|
|
|
4
4
|
validationResult: PasswordValidationResult | null;
|
|
5
5
|
showHints?: boolean;
|
|
6
6
|
showRules?: boolean;
|
|
7
|
+
weakLabel?: string;
|
|
8
|
+
mediumLabel?: string;
|
|
9
|
+
strongLabel?: string;
|
|
10
|
+
unknownLabel?: string;
|
|
11
|
+
requirementsTitleText?: string;
|
|
12
|
+
hintsTitleText?: string;
|
|
7
13
|
}
|
|
8
14
|
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
9
15
|
showHints: boolean;
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed } from "vue";
|
|
3
3
|
import { useRuntimeConfig } from "#app";
|
|
4
|
+
import { useNuxtUsersLocale } from "../composables/useNuxtUsersLocale";
|
|
5
|
+
const { t } = useNuxtUsersLocale();
|
|
4
6
|
const props = defineProps({
|
|
5
7
|
password: { type: String, required: true },
|
|
6
8
|
validationResult: { type: null, required: true },
|
|
7
9
|
showHints: { type: Boolean, required: false, default: true },
|
|
8
|
-
showRules: { type: Boolean, required: false, default: true }
|
|
10
|
+
showRules: { type: Boolean, required: false, default: true },
|
|
11
|
+
weakLabel: { type: String, required: false },
|
|
12
|
+
mediumLabel: { type: String, required: false },
|
|
13
|
+
strongLabel: { type: String, required: false },
|
|
14
|
+
unknownLabel: { type: String, required: false },
|
|
15
|
+
requirementsTitleText: { type: String, required: false },
|
|
16
|
+
hintsTitleText: { type: String, required: false }
|
|
9
17
|
});
|
|
10
18
|
const { public: { nuxtUsers } } = useRuntimeConfig();
|
|
11
19
|
const moduleOptions = nuxtUsers;
|
|
@@ -18,35 +26,35 @@ const validationRules = computed(() => {
|
|
|
18
26
|
if (moduleOptions.passwordValidation.minLength) {
|
|
19
27
|
const hasMinLength = props.password.length >= moduleOptions.passwordValidation.minLength;
|
|
20
28
|
rules.push({
|
|
21
|
-
text:
|
|
29
|
+
text: t("passwordStrength.minLength", [moduleOptions.passwordValidation.minLength]),
|
|
22
30
|
passed: hasMinLength
|
|
23
31
|
});
|
|
24
32
|
}
|
|
25
33
|
if (moduleOptions.passwordValidation.requireUppercase) {
|
|
26
34
|
const hasUppercase = /[A-Z]/.test(props.password);
|
|
27
35
|
rules.push({
|
|
28
|
-
text: "
|
|
36
|
+
text: t("passwordStrength.uppercase"),
|
|
29
37
|
passed: hasUppercase
|
|
30
38
|
});
|
|
31
39
|
}
|
|
32
40
|
if (moduleOptions.passwordValidation.requireLowercase) {
|
|
33
41
|
const hasLowercase = /[a-z]/.test(props.password);
|
|
34
42
|
rules.push({
|
|
35
|
-
text: "
|
|
43
|
+
text: t("passwordStrength.lowercase"),
|
|
36
44
|
passed: hasLowercase
|
|
37
45
|
});
|
|
38
46
|
}
|
|
39
47
|
if (moduleOptions.passwordValidation.requireNumbers) {
|
|
40
48
|
const hasNumbers = /\d/.test(props.password);
|
|
41
49
|
rules.push({
|
|
42
|
-
text: "
|
|
50
|
+
text: t("passwordStrength.number"),
|
|
43
51
|
passed: hasNumbers
|
|
44
52
|
});
|
|
45
53
|
}
|
|
46
54
|
if (moduleOptions.passwordValidation.requireSpecialChars) {
|
|
47
55
|
const hasSpecialChars = /[!@#$%^&*()_+\-=[\]{};':"\\|,.<>/?]/.test(props.password);
|
|
48
56
|
rules.push({
|
|
49
|
-
text: "
|
|
57
|
+
text: t("passwordStrength.specialChar"),
|
|
50
58
|
passed: hasSpecialChars
|
|
51
59
|
});
|
|
52
60
|
}
|
|
@@ -74,7 +82,7 @@ const validationRules = computed(() => {
|
|
|
74
82
|
color: validationResult?.strength === 'weak' ? '#dc3545' : validationResult?.strength === 'medium' ? '#ffc107' : validationResult?.strength === 'strong' ? '#28a745' : '#6c757d'
|
|
75
83
|
}"
|
|
76
84
|
>
|
|
77
|
-
{{ validationResult?.strength === "weak" ? "
|
|
85
|
+
{{ validationResult?.strength === "weak" ? props.weakLabel || t("passwordStrength.weak") : validationResult?.strength === "medium" ? props.mediumLabel || t("passwordStrength.medium") : validationResult?.strength === "strong" ? props.strongLabel || t("passwordStrength.strong") : props.unknownLabel || t("passwordStrength.unknown") }}
|
|
78
86
|
({{ validationResult?.score || 0 }}%)
|
|
79
87
|
</span>
|
|
80
88
|
</div>
|
|
@@ -85,7 +93,7 @@ const validationRules = computed(() => {
|
|
|
85
93
|
class="n-users-validation-rules n-users-validation-container"
|
|
86
94
|
>
|
|
87
95
|
<div class="n-users-rules-title n-users-container-title">
|
|
88
|
-
|
|
96
|
+
{{ props.requirementsTitleText || t("passwordStrength.label") }}
|
|
89
97
|
</div>
|
|
90
98
|
<ul class="n-users-rules-list n-users-list-unstyled">
|
|
91
99
|
<li
|
|
@@ -124,7 +132,7 @@ const validationRules = computed(() => {
|
|
|
124
132
|
class="n-users-password-hints n-users-validation-container"
|
|
125
133
|
>
|
|
126
134
|
<div class="n-users-hint-title n-users-container-title">
|
|
127
|
-
|
|
135
|
+
{{ props.hintsTitleText || t("passwordStrength.hintsTitle") }}
|
|
128
136
|
</div>
|
|
129
137
|
<ul class="n-users-hint-list n-users-list-unstyled">
|
|
130
138
|
<li
|
|
@@ -4,6 +4,12 @@ interface Props {
|
|
|
4
4
|
validationResult: PasswordValidationResult | null;
|
|
5
5
|
showHints?: boolean;
|
|
6
6
|
showRules?: boolean;
|
|
7
|
+
weakLabel?: string;
|
|
8
|
+
mediumLabel?: string;
|
|
9
|
+
strongLabel?: string;
|
|
10
|
+
unknownLabel?: string;
|
|
11
|
+
requirementsTitleText?: string;
|
|
12
|
+
hintsTitleText?: string;
|
|
7
13
|
}
|
|
8
14
|
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {
|
|
9
15
|
showHints: boolean;
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
interface Props {
|
|
2
|
+
title?: string;
|
|
3
|
+
nameLabel?: string;
|
|
4
|
+
emailLabel?: string;
|
|
5
|
+
roleLabel?: string;
|
|
6
|
+
registeredLabel?: string;
|
|
7
|
+
lastUpdatedLabel?: string;
|
|
8
|
+
activeLabel?: string;
|
|
9
|
+
idLabel?: string;
|
|
10
|
+
yesText?: string;
|
|
11
|
+
noText?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
2
14
|
declare const _default: typeof __VLS_export;
|
|
3
15
|
export default _default;
|
|
@@ -1,6 +1,20 @@
|
|
|
1
1
|
<script setup>
|
|
2
2
|
import { computed, onMounted, ref } from "vue";
|
|
3
3
|
import { useAuthentication } from "../composables/useAuthentication";
|
|
4
|
+
import { useNuxtUsersLocale } from "../composables/useNuxtUsersLocale";
|
|
5
|
+
const { t } = useNuxtUsersLocale();
|
|
6
|
+
const props = defineProps({
|
|
7
|
+
title: { type: String, required: false },
|
|
8
|
+
nameLabel: { type: String, required: false },
|
|
9
|
+
emailLabel: { type: String, required: false },
|
|
10
|
+
roleLabel: { type: String, required: false },
|
|
11
|
+
registeredLabel: { type: String, required: false },
|
|
12
|
+
lastUpdatedLabel: { type: String, required: false },
|
|
13
|
+
activeLabel: { type: String, required: false },
|
|
14
|
+
idLabel: { type: String, required: false },
|
|
15
|
+
yesText: { type: String, required: false },
|
|
16
|
+
noText: { type: String, required: false }
|
|
17
|
+
});
|
|
4
18
|
const authComposable = ref(null);
|
|
5
19
|
const user = computed(() => authComposable.value?.user ?? null);
|
|
6
20
|
onMounted(() => {
|
|
@@ -11,31 +25,31 @@ onMounted(() => {
|
|
|
11
25
|
<template>
|
|
12
26
|
<div class="n-users-profile-info n-users-section">
|
|
13
27
|
<h2 class="n-users-section-header">
|
|
14
|
-
|
|
28
|
+
{{ props.title || t("profile.title") }}
|
|
15
29
|
</h2>
|
|
16
30
|
<dl
|
|
17
31
|
v-if="user"
|
|
18
32
|
class="n-users-profile-details n-users-grid n-users-grid-2"
|
|
19
33
|
>
|
|
20
|
-
<dt>
|
|
34
|
+
<dt>{{ props.nameLabel || t("profile.name") }}</dt>
|
|
21
35
|
<dd>{{ user.name }}</dd>
|
|
22
36
|
|
|
23
|
-
<dt>
|
|
37
|
+
<dt>{{ props.emailLabel || t("profile.email") }}</dt>
|
|
24
38
|
<dd>{{ user.email }}</dd>
|
|
25
39
|
|
|
26
|
-
<dt>
|
|
40
|
+
<dt>{{ props.roleLabel || t("profile.role") }}</dt>
|
|
27
41
|
<dd>{{ user.role }}</dd>
|
|
28
42
|
|
|
29
|
-
<dt>
|
|
43
|
+
<dt>{{ props.registeredLabel || t("profile.registered") }}</dt>
|
|
30
44
|
<dd>{{ Intl.DateTimeFormat().format(new Date(user.created_at)) }}</dd>
|
|
31
45
|
|
|
32
|
-
<dt>
|
|
46
|
+
<dt>{{ props.lastUpdatedLabel || t("profile.lastUpdated") }}</dt>
|
|
33
47
|
<dd>{{ Intl.DateTimeFormat().format(new Date(user.updated_at)) }}</dd>
|
|
34
48
|
|
|
35
|
-
<dt>
|
|
36
|
-
<dd>{{ user.active ? "
|
|
49
|
+
<dt>{{ props.activeLabel || t("profile.active") }}</dt>
|
|
50
|
+
<dd>{{ user.active ? props.yesText || t("common.yes") : props.noText || t("common.no") }}</dd>
|
|
37
51
|
|
|
38
|
-
<dt>
|
|
52
|
+
<dt>{{ props.idLabel || t("profile.id") }}</dt>
|
|
39
53
|
<dd>{{ user.id }}</dd>
|
|
40
54
|
</dl>
|
|
41
55
|
</div>
|
|
@@ -1,3 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
interface Props {
|
|
2
|
+
title?: string;
|
|
3
|
+
nameLabel?: string;
|
|
4
|
+
emailLabel?: string;
|
|
5
|
+
roleLabel?: string;
|
|
6
|
+
registeredLabel?: string;
|
|
7
|
+
lastUpdatedLabel?: string;
|
|
8
|
+
activeLabel?: string;
|
|
9
|
+
idLabel?: string;
|
|
10
|
+
yesText?: string;
|
|
11
|
+
noText?: string;
|
|
12
|
+
}
|
|
13
|
+
declare const __VLS_export: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
2
14
|
declare const _default: typeof __VLS_export;
|
|
3
15
|
export default _default;
|
|
@@ -3,6 +3,21 @@ interface Props {
|
|
|
3
3
|
apiEndpoint?: string;
|
|
4
4
|
redirectTo?: string;
|
|
5
5
|
loginLink?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
subtitle?: string;
|
|
8
|
+
nameLabel?: string;
|
|
9
|
+
namePlaceholder?: string;
|
|
10
|
+
emailLabel?: string;
|
|
11
|
+
emailPlaceholder?: string;
|
|
12
|
+
passwordLabel?: string;
|
|
13
|
+
passwordPlaceholder?: string;
|
|
14
|
+
confirmPasswordLabel?: string;
|
|
15
|
+
confirmPasswordPlaceholder?: string;
|
|
16
|
+
passwordMismatchError?: string;
|
|
17
|
+
submitLabel?: string;
|
|
18
|
+
submittingLabel?: string;
|
|
19
|
+
alreadyHaveAccountText?: string;
|
|
20
|
+
signInLinkText?: string;
|
|
6
21
|
}
|
|
7
22
|
interface RegistrationFormData {
|
|
8
23
|
email: string;
|
|
@@ -10,9 +25,9 @@ interface RegistrationFormData {
|
|
|
10
25
|
password: string;
|
|
11
26
|
confirmPassword: string;
|
|
12
27
|
}
|
|
13
|
-
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {}, __VLS_9: {},
|
|
28
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {}, __VLS_9: {}, __VLS_16: {}, __VLS_18: {}, __VLS_20: {}, __VLS_22: {
|
|
14
29
|
message: string;
|
|
15
|
-
},
|
|
30
|
+
}, __VLS_24: {
|
|
16
31
|
error: string;
|
|
17
32
|
};
|
|
18
33
|
type __VLS_Slots = {} & {
|
|
@@ -26,30 +41,30 @@ type __VLS_Slots = {} & {
|
|
|
26
41
|
} & {
|
|
27
42
|
'password-strength'?: (props: typeof __VLS_9) => any;
|
|
28
43
|
} & {
|
|
29
|
-
'confirm-password-field'?: (props: typeof
|
|
44
|
+
'confirm-password-field'?: (props: typeof __VLS_16) => any;
|
|
30
45
|
} & {
|
|
31
|
-
'submit-button'?: (props: typeof
|
|
46
|
+
'submit-button'?: (props: typeof __VLS_18) => any;
|
|
32
47
|
} & {
|
|
33
|
-
footer?: (props: typeof
|
|
48
|
+
footer?: (props: typeof __VLS_20) => any;
|
|
34
49
|
} & {
|
|
35
|
-
'success-message'?: (props: typeof
|
|
50
|
+
'success-message'?: (props: typeof __VLS_22) => any;
|
|
36
51
|
} & {
|
|
37
|
-
'error-message'?: (props: typeof
|
|
52
|
+
'error-message'?: (props: typeof __VLS_24) => any;
|
|
38
53
|
};
|
|
39
54
|
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
55
|
+
error: (error: string) => any;
|
|
56
|
+
submit: (data: RegistrationFormData) => any;
|
|
40
57
|
success: (data: {
|
|
41
58
|
user: Omit<UserWithoutPassword, "active">;
|
|
42
59
|
message: string;
|
|
43
60
|
}) => any;
|
|
44
|
-
error: (error: string) => any;
|
|
45
|
-
submit: (data: RegistrationFormData) => any;
|
|
46
61
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
62
|
+
onError?: ((error: string) => any) | undefined;
|
|
63
|
+
onSubmit?: ((data: RegistrationFormData) => any) | undefined;
|
|
47
64
|
onSuccess?: ((data: {
|
|
48
65
|
user: Omit<UserWithoutPassword, "active">;
|
|
49
66
|
message: string;
|
|
50
67
|
}) => any) | undefined;
|
|
51
|
-
onError?: ((error: string) => any) | undefined;
|
|
52
|
-
onSubmit?: ((data: RegistrationFormData) => any) | undefined;
|
|
53
68
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
54
69
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
55
70
|
declare const _default: typeof __VLS_export;
|
|
@@ -3,12 +3,29 @@ import { ref, computed, watch } from "vue";
|
|
|
3
3
|
import { navigateTo } from "#app";
|
|
4
4
|
import { useRuntimeConfig } from "#imports";
|
|
5
5
|
import { validatePassword } from "nuxt-users/utils";
|
|
6
|
+
import { useNuxtUsersLocale } from "../composables/useNuxtUsersLocale";
|
|
6
7
|
const { public: { nuxtUsers } } = useRuntimeConfig();
|
|
7
8
|
const { passwordValidation } = nuxtUsers;
|
|
9
|
+
const { t } = useNuxtUsersLocale();
|
|
8
10
|
const props = defineProps({
|
|
9
11
|
apiEndpoint: { type: String, required: false },
|
|
10
12
|
redirectTo: { type: String, required: false },
|
|
11
|
-
loginLink: { type: String, required: false }
|
|
13
|
+
loginLink: { type: String, required: false },
|
|
14
|
+
title: { type: String, required: false },
|
|
15
|
+
subtitle: { type: String, required: false },
|
|
16
|
+
nameLabel: { type: String, required: false },
|
|
17
|
+
namePlaceholder: { type: String, required: false },
|
|
18
|
+
emailLabel: { type: String, required: false },
|
|
19
|
+
emailPlaceholder: { type: String, required: false },
|
|
20
|
+
passwordLabel: { type: String, required: false },
|
|
21
|
+
passwordPlaceholder: { type: String, required: false },
|
|
22
|
+
confirmPasswordLabel: { type: String, required: false },
|
|
23
|
+
confirmPasswordPlaceholder: { type: String, required: false },
|
|
24
|
+
passwordMismatchError: { type: String, required: false },
|
|
25
|
+
submitLabel: { type: String, required: false },
|
|
26
|
+
submittingLabel: { type: String, required: false },
|
|
27
|
+
alreadyHaveAccountText: { type: String, required: false },
|
|
28
|
+
signInLinkText: { type: String, required: false }
|
|
12
29
|
});
|
|
13
30
|
const emit = defineEmits(["success", "error", "submit"]);
|
|
14
31
|
const apiEndpoint = computed(() => props.apiEndpoint || `${nuxtUsers?.apiBasePath}/register`);
|
|
@@ -25,7 +42,8 @@ const formData = ref({
|
|
|
25
42
|
watch(() => formData.value.password, (newPassword) => {
|
|
26
43
|
if (newPassword) {
|
|
27
44
|
passwordValidationResult.value = validatePassword(newPassword, passwordValidation);
|
|
28
|
-
}
|
|
45
|
+
}
|
|
46
|
+
if (!newPassword) {
|
|
29
47
|
passwordValidationResult.value = null;
|
|
30
48
|
}
|
|
31
49
|
}, { immediate: true });
|
|
@@ -83,10 +101,10 @@ const handleSubmit = async () => {
|
|
|
83
101
|
<slot name="header">
|
|
84
102
|
<div class="n-users-register-header">
|
|
85
103
|
<h2 class="n-users-register-title">
|
|
86
|
-
|
|
104
|
+
{{ props.title || t("register.title") }}
|
|
87
105
|
</h2>
|
|
88
106
|
<p class="n-users-register-subtitle">
|
|
89
|
-
|
|
107
|
+
{{ props.subtitle || t("register.subtitle") }}
|
|
90
108
|
</p>
|
|
91
109
|
</div>
|
|
92
110
|
</slot>
|
|
@@ -94,13 +112,13 @@ const handleSubmit = async () => {
|
|
|
94
112
|
<!-- Name field -->
|
|
95
113
|
<slot name="name-field">
|
|
96
114
|
<div class="n-users-form-group">
|
|
97
|
-
<label for="name">
|
|
115
|
+
<label for="name">{{ props.nameLabel || t("register.nameLabel") }}</label>
|
|
98
116
|
<input
|
|
99
117
|
id="name"
|
|
100
118
|
v-model="formData.name"
|
|
101
119
|
type="text"
|
|
102
120
|
name="name"
|
|
103
|
-
placeholder="
|
|
121
|
+
:placeholder="props.namePlaceholder || t('register.namePlaceholder')"
|
|
104
122
|
required
|
|
105
123
|
>
|
|
106
124
|
</div>
|
|
@@ -109,13 +127,13 @@ const handleSubmit = async () => {
|
|
|
109
127
|
<!-- Email field -->
|
|
110
128
|
<slot name="email-field">
|
|
111
129
|
<div class="n-users-form-group">
|
|
112
|
-
<label for="email">
|
|
130
|
+
<label for="email">{{ props.emailLabel || t("common.email") }}</label>
|
|
113
131
|
<input
|
|
114
132
|
id="email"
|
|
115
133
|
v-model="formData.email"
|
|
116
134
|
type="email"
|
|
117
135
|
name="email"
|
|
118
|
-
placeholder="
|
|
136
|
+
:placeholder="props.emailPlaceholder || t('register.emailPlaceholder')"
|
|
119
137
|
required
|
|
120
138
|
>
|
|
121
139
|
</div>
|
|
@@ -124,13 +142,13 @@ const handleSubmit = async () => {
|
|
|
124
142
|
<!-- Password field -->
|
|
125
143
|
<slot name="password-field">
|
|
126
144
|
<div class="n-users-form-group">
|
|
127
|
-
<label for="password">
|
|
145
|
+
<label for="password">{{ props.passwordLabel || t("register.passwordLabel") }}</label>
|
|
128
146
|
<input
|
|
129
147
|
id="password"
|
|
130
148
|
v-model="formData.password"
|
|
131
149
|
type="password"
|
|
132
150
|
name="password"
|
|
133
|
-
placeholder="
|
|
151
|
+
:placeholder="props.passwordPlaceholder || t('register.passwordPlaceholder')"
|
|
134
152
|
required
|
|
135
153
|
:minlength="passwordValidation.minLength"
|
|
136
154
|
>
|
|
@@ -151,13 +169,13 @@ const handleSubmit = async () => {
|
|
|
151
169
|
<!-- Confirm Password field -->
|
|
152
170
|
<slot name="confirm-password-field">
|
|
153
171
|
<div class="n-users-form-group">
|
|
154
|
-
<label for="confirmPassword">
|
|
172
|
+
<label for="confirmPassword">{{ props.confirmPasswordLabel || t("register.confirmPasswordLabel") }}</label>
|
|
155
173
|
<input
|
|
156
174
|
id="confirmPassword"
|
|
157
175
|
v-model="formData.confirmPassword"
|
|
158
176
|
type="password"
|
|
159
177
|
name="confirmPassword"
|
|
160
|
-
placeholder="
|
|
178
|
+
:placeholder="props.confirmPasswordPlaceholder || t('register.confirmPasswordPlaceholder')"
|
|
161
179
|
required
|
|
162
180
|
:class="{ 'n-users-input-error': !passwordsMatch }"
|
|
163
181
|
>
|
|
@@ -165,7 +183,7 @@ const handleSubmit = async () => {
|
|
|
165
183
|
v-if="!passwordsMatch && formData.confirmPassword"
|
|
166
184
|
class="n-users-error-text"
|
|
167
185
|
>
|
|
168
|
-
|
|
186
|
+
{{ props.passwordMismatchError || t("register.passwordMismatch") }}
|
|
169
187
|
</small>
|
|
170
188
|
</div>
|
|
171
189
|
</slot>
|
|
@@ -180,7 +198,7 @@ const handleSubmit = async () => {
|
|
|
180
198
|
v-if="isLoading"
|
|
181
199
|
class="n-users-loading-spinner"
|
|
182
200
|
/>
|
|
183
|
-
{{ isLoading ?
|
|
201
|
+
{{ isLoading ? props.submittingLabel || t("register.submitting") : props.submitLabel || t("register.submit") }}
|
|
184
202
|
</button>
|
|
185
203
|
</slot>
|
|
186
204
|
|
|
@@ -188,12 +206,12 @@ const handleSubmit = async () => {
|
|
|
188
206
|
<slot name="footer">
|
|
189
207
|
<div class="n-users-register-footer">
|
|
190
208
|
<p class="n-users-login-link">
|
|
191
|
-
|
|
209
|
+
{{ props.alreadyHaveAccountText || t("register.alreadyHaveAccount") }}
|
|
192
210
|
<a
|
|
193
211
|
:href="loginLink || '/login'"
|
|
194
212
|
class="n-users-link"
|
|
195
213
|
>
|
|
196
|
-
|
|
214
|
+
{{ props.signInLinkText || t("register.signInLink") }}
|
|
197
215
|
</a>
|
|
198
216
|
</p>
|
|
199
217
|
</div>
|
|
@@ -3,6 +3,21 @@ interface Props {
|
|
|
3
3
|
apiEndpoint?: string;
|
|
4
4
|
redirectTo?: string;
|
|
5
5
|
loginLink?: string;
|
|
6
|
+
title?: string;
|
|
7
|
+
subtitle?: string;
|
|
8
|
+
nameLabel?: string;
|
|
9
|
+
namePlaceholder?: string;
|
|
10
|
+
emailLabel?: string;
|
|
11
|
+
emailPlaceholder?: string;
|
|
12
|
+
passwordLabel?: string;
|
|
13
|
+
passwordPlaceholder?: string;
|
|
14
|
+
confirmPasswordLabel?: string;
|
|
15
|
+
confirmPasswordPlaceholder?: string;
|
|
16
|
+
passwordMismatchError?: string;
|
|
17
|
+
submitLabel?: string;
|
|
18
|
+
submittingLabel?: string;
|
|
19
|
+
alreadyHaveAccountText?: string;
|
|
20
|
+
signInLinkText?: string;
|
|
6
21
|
}
|
|
7
22
|
interface RegistrationFormData {
|
|
8
23
|
email: string;
|
|
@@ -10,9 +25,9 @@ interface RegistrationFormData {
|
|
|
10
25
|
password: string;
|
|
11
26
|
confirmPassword: string;
|
|
12
27
|
}
|
|
13
|
-
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {}, __VLS_9: {},
|
|
28
|
+
declare var __VLS_1: {}, __VLS_3: {}, __VLS_5: {}, __VLS_7: {}, __VLS_9: {}, __VLS_16: {}, __VLS_18: {}, __VLS_20: {}, __VLS_22: {
|
|
14
29
|
message: string;
|
|
15
|
-
},
|
|
30
|
+
}, __VLS_24: {
|
|
16
31
|
error: string;
|
|
17
32
|
};
|
|
18
33
|
type __VLS_Slots = {} & {
|
|
@@ -26,30 +41,30 @@ type __VLS_Slots = {} & {
|
|
|
26
41
|
} & {
|
|
27
42
|
'password-strength'?: (props: typeof __VLS_9) => any;
|
|
28
43
|
} & {
|
|
29
|
-
'confirm-password-field'?: (props: typeof
|
|
44
|
+
'confirm-password-field'?: (props: typeof __VLS_16) => any;
|
|
30
45
|
} & {
|
|
31
|
-
'submit-button'?: (props: typeof
|
|
46
|
+
'submit-button'?: (props: typeof __VLS_18) => any;
|
|
32
47
|
} & {
|
|
33
|
-
footer?: (props: typeof
|
|
48
|
+
footer?: (props: typeof __VLS_20) => any;
|
|
34
49
|
} & {
|
|
35
|
-
'success-message'?: (props: typeof
|
|
50
|
+
'success-message'?: (props: typeof __VLS_22) => any;
|
|
36
51
|
} & {
|
|
37
|
-
'error-message'?: (props: typeof
|
|
52
|
+
'error-message'?: (props: typeof __VLS_24) => any;
|
|
38
53
|
};
|
|
39
54
|
declare const __VLS_base: import("vue").DefineComponent<Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
55
|
+
error: (error: string) => any;
|
|
56
|
+
submit: (data: RegistrationFormData) => any;
|
|
40
57
|
success: (data: {
|
|
41
58
|
user: Omit<UserWithoutPassword, "active">;
|
|
42
59
|
message: string;
|
|
43
60
|
}) => any;
|
|
44
|
-
error: (error: string) => any;
|
|
45
|
-
submit: (data: RegistrationFormData) => any;
|
|
46
61
|
}, string, import("vue").PublicProps, Readonly<Props> & Readonly<{
|
|
62
|
+
onError?: ((error: string) => any) | undefined;
|
|
63
|
+
onSubmit?: ((data: RegistrationFormData) => any) | undefined;
|
|
47
64
|
onSuccess?: ((data: {
|
|
48
65
|
user: Omit<UserWithoutPassword, "active">;
|
|
49
66
|
message: string;
|
|
50
67
|
}) => any) | undefined;
|
|
51
|
-
onError?: ((error: string) => any) | undefined;
|
|
52
|
-
onSubmit?: ((data: RegistrationFormData) => any) | undefined;
|
|
53
68
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
54
69
|
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
55
70
|
declare const _default: typeof __VLS_export;
|