pukaad-ui-lib 1.273.0 → 1.275.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/dist/module.json +1 -1
- package/dist/runtime/components/modal/modal-2FA.d.vue.ts +2 -0
- package/dist/runtime/components/modal/modal-2FA.vue +1 -1
- package/dist/runtime/components/modal/modal-2FA.vue.d.ts +2 -0
- package/dist/runtime/components/modal/modal-password-new.d.vue.ts +4 -0
- package/dist/runtime/components/modal/modal-password-new.vue +38 -30
- package/dist/runtime/components/modal/modal-password-new.vue.d.ts +4 -0
- package/dist/runtime/components/modal/modal-password-verify.d.vue.ts +4 -0
- package/dist/runtime/components/modal/modal-password-verify.vue +3 -2
- package/dist/runtime/components/modal/modal-password-verify.vue.d.ts +4 -0
- package/dist/runtime/components/modal/modal-secure.vue +18 -1
- package/package.json +1 -1
- /package/dist/runtime/assets/svg/socials/{Whatsapp.svg → WhatsApp.svg} +0 -0
package/dist/module.json
CHANGED
|
@@ -9,11 +9,13 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
9
9
|
} & {
|
|
10
10
|
complete: (data: {
|
|
11
11
|
token: string;
|
|
12
|
+
code?: string;
|
|
12
13
|
}) => any;
|
|
13
14
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
15
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
15
16
|
onComplete?: ((data: {
|
|
16
17
|
token: string;
|
|
18
|
+
code?: string;
|
|
17
19
|
}) => any) | undefined;
|
|
18
20
|
}>, {
|
|
19
21
|
confirmedText: string;
|
|
@@ -60,7 +60,7 @@ const onVerify2FA = async () => {
|
|
|
60
60
|
}
|
|
61
61
|
);
|
|
62
62
|
if (!data) throw "error";
|
|
63
|
-
emit("complete", data);
|
|
63
|
+
emit("complete", { ...data, code: valueOTP.value });
|
|
64
64
|
isOpen.value = false;
|
|
65
65
|
} catch (e) {
|
|
66
66
|
const errorMessage = "\u0E23\u0E2B\u0E31\u0E2A\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07";
|
|
@@ -9,11 +9,13 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
9
9
|
} & {
|
|
10
10
|
complete: (data: {
|
|
11
11
|
token: string;
|
|
12
|
+
code?: string;
|
|
12
13
|
}) => any;
|
|
13
14
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
14
15
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
15
16
|
onComplete?: ((data: {
|
|
16
17
|
token: string;
|
|
18
|
+
code?: string;
|
|
17
19
|
}) => any) | undefined;
|
|
18
20
|
}>, {
|
|
19
21
|
confirmedText: string;
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
interface Props {
|
|
2
|
+
mode?: "login" | "secure";
|
|
2
3
|
title?: string;
|
|
3
4
|
confirmText?: string;
|
|
4
5
|
loginToken?: string;
|
|
5
6
|
/** When provided, uses forgot-password reset endpoint instead of password/create */
|
|
6
7
|
resetToken?: string;
|
|
7
8
|
disabledForceLogout?: boolean;
|
|
9
|
+
oldPassword?: string;
|
|
10
|
+
twoFaCode?: string;
|
|
8
11
|
}
|
|
9
12
|
type __VLS_Props = Props;
|
|
10
13
|
type __VLS_ModelProps = {
|
|
@@ -25,6 +28,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
25
28
|
} | null) => any) | undefined;
|
|
26
29
|
}>, {
|
|
27
30
|
title: string;
|
|
31
|
+
mode: "login" | "secure";
|
|
28
32
|
confirmText: string;
|
|
29
33
|
disabledForceLogout: boolean;
|
|
30
34
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -1,34 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<Modal
|
|
3
|
-
|
|
4
|
-
:loading="loading"
|
|
5
|
-
v-model="isOpen"
|
|
6
|
-
@close="emit('close')"
|
|
7
|
-
@submit="handleSubmit"
|
|
8
|
-
width="425px"
|
|
9
|
-
>
|
|
2
|
+
<Modal :title="props.title" :loading="loading" v-model="isOpen" @close="emit('close')" @submit="handleSubmit"
|
|
3
|
+
width="425px">
|
|
10
4
|
<div class="flex flex-col gap-2">
|
|
11
|
-
<InputPassword
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
label="รหัสผ่าน"
|
|
16
|
-
placeholder="กรอกรหัสผ่าน"
|
|
17
|
-
v-model="password"
|
|
18
|
-
/>
|
|
19
|
-
<InputCheckbox
|
|
20
|
-
v-if="!props.disabledForceLogout"
|
|
21
|
-
label="ออกจากระบบ Pukaad ในอุปกรณ์อื่นๆทั้งหมด"
|
|
22
|
-
v-model="logoutAll"
|
|
23
|
-
/>
|
|
5
|
+
<InputPassword disabled-forgot-password new required label="รหัสผ่าน" placeholder="กรอกรหัสผ่าน"
|
|
6
|
+
v-model="password" />
|
|
7
|
+
<InputCheckbox v-if="!props.disabledForceLogout" label="ออกจากระบบ Pukaad ในอุปกรณ์อื่นๆทั้งหมด"
|
|
8
|
+
v-model="logoutAll" />
|
|
24
9
|
</div>
|
|
25
10
|
<template #footer="{ meta }">
|
|
26
|
-
<Button
|
|
27
|
-
type="submit"
|
|
28
|
-
color="primary"
|
|
29
|
-
class="w-full"
|
|
30
|
-
:disabled="!meta.valid"
|
|
31
|
-
>
|
|
11
|
+
<Button type="submit" color="primary" class="w-full" :disabled="!meta.valid">
|
|
32
12
|
{{ props.confirmText }}
|
|
33
13
|
</Button>
|
|
34
14
|
</template>
|
|
@@ -40,11 +20,14 @@ import { ref, computed, watch } from "vue";
|
|
|
40
20
|
import { useNuxtApp, useRuntimeConfig } from "nuxt/app";
|
|
41
21
|
import { useApi } from "../../composables/useApi";
|
|
42
22
|
const props = defineProps({
|
|
23
|
+
mode: { type: String, required: false, default: "login" },
|
|
43
24
|
title: { type: String, required: false, default: "\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E43\u0E2B\u0E21\u0E48" },
|
|
44
25
|
confirmText: { type: String, required: false, default: "\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19" },
|
|
45
26
|
loginToken: { type: String, required: false },
|
|
46
27
|
resetToken: { type: String, required: false },
|
|
47
|
-
disabledForceLogout: { type: Boolean, required: false, default: false }
|
|
28
|
+
disabledForceLogout: { type: Boolean, required: false, default: false },
|
|
29
|
+
oldPassword: { type: String, required: false },
|
|
30
|
+
twoFaCode: { type: String, required: false }
|
|
48
31
|
});
|
|
49
32
|
const emit = defineEmits(["complete", "close"]);
|
|
50
33
|
const { $toast } = useNuxtApp();
|
|
@@ -64,6 +47,29 @@ watch(isOpen, (open) => {
|
|
|
64
47
|
}
|
|
65
48
|
});
|
|
66
49
|
const handleSubmit = async () => {
|
|
50
|
+
if (props.mode === "secure") {
|
|
51
|
+
loading.value = true;
|
|
52
|
+
try {
|
|
53
|
+
await api("/me/change-password", {
|
|
54
|
+
method: "POST",
|
|
55
|
+
body: {
|
|
56
|
+
old_password: props.oldPassword,
|
|
57
|
+
new_password: password.value,
|
|
58
|
+
...props.twoFaCode ? { two_fa_code: props.twoFaCode } : {},
|
|
59
|
+
logout_all: logoutAll.value
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
emit("complete", null);
|
|
63
|
+
isOpen.value = false;
|
|
64
|
+
$toast?.success?.("\u0E40\u0E1B\u0E25\u0E35\u0E48\u0E22\u0E19\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08");
|
|
65
|
+
} catch (e) {
|
|
66
|
+
const msg = e?.data?.message?.description || e?.data?.message || "\u0E40\u0E01\u0E34\u0E14\u0E02\u0E49\u0E2D\u0E1C\u0E34\u0E14\u0E1E\u0E25\u0E32\u0E14\u0E43\u0E19\u0E01\u0E32\u0E23\u0E40\u0E0A\u0E37\u0E48\u0E2D\u0E21\u0E15\u0E48\u0E2D";
|
|
67
|
+
$toast?.error?.(msg);
|
|
68
|
+
} finally {
|
|
69
|
+
loading.value = false;
|
|
70
|
+
}
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
67
73
|
if (props.resetToken) {
|
|
68
74
|
loading.value = true;
|
|
69
75
|
try {
|
|
@@ -84,10 +90,12 @@ const handleSubmit = async () => {
|
|
|
84
90
|
loading.value = false;
|
|
85
91
|
}
|
|
86
92
|
return;
|
|
87
|
-
}
|
|
88
|
-
if (!props.loginToken) {
|
|
93
|
+
} else if (!props.loginToken) {
|
|
89
94
|
$toast?.error?.("\u0E44\u0E21\u0E48\u0E1E\u0E1A login token");
|
|
90
95
|
return;
|
|
96
|
+
} else if (!props.oldPassword) {
|
|
97
|
+
$toast?.error?.("\u0E44\u0E21\u0E48\u0E1E\u0E1A \u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E40\u0E14\u0E34\u0E21");
|
|
98
|
+
return;
|
|
91
99
|
}
|
|
92
100
|
loading.value = true;
|
|
93
101
|
try {
|
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
interface Props {
|
|
2
|
+
mode?: "login" | "secure";
|
|
2
3
|
title?: string;
|
|
3
4
|
confirmText?: string;
|
|
4
5
|
loginToken?: string;
|
|
5
6
|
/** When provided, uses forgot-password reset endpoint instead of password/create */
|
|
6
7
|
resetToken?: string;
|
|
7
8
|
disabledForceLogout?: boolean;
|
|
9
|
+
oldPassword?: string;
|
|
10
|
+
twoFaCode?: string;
|
|
8
11
|
}
|
|
9
12
|
type __VLS_Props = Props;
|
|
10
13
|
type __VLS_ModelProps = {
|
|
@@ -25,6 +28,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
25
28
|
} | null) => any) | undefined;
|
|
26
29
|
}>, {
|
|
27
30
|
title: string;
|
|
31
|
+
mode: "login" | "secure";
|
|
28
32
|
confirmText: string;
|
|
29
33
|
disabledForceLogout: boolean;
|
|
30
34
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
@@ -18,12 +18,16 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
18
18
|
"update:modelValue": (value: boolean) => any;
|
|
19
19
|
complete: (data: {
|
|
20
20
|
secId: string;
|
|
21
|
+
resetToken?: string;
|
|
22
|
+
password?: string;
|
|
21
23
|
}) => any;
|
|
22
24
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
23
25
|
onClose?: (() => any) | undefined;
|
|
24
26
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
25
27
|
onComplete?: ((data: {
|
|
26
28
|
secId: string;
|
|
29
|
+
resetToken?: string;
|
|
30
|
+
password?: string;
|
|
27
31
|
}) => any) | undefined;
|
|
28
32
|
}>, {
|
|
29
33
|
title: string;
|
|
@@ -51,7 +51,7 @@ const handleSubmit = async () => {
|
|
|
51
51
|
body: { password: password.value }
|
|
52
52
|
});
|
|
53
53
|
if (res.message?.title !== "\u0E2A\u0E33\u0E40\u0E23\u0E47\u0E08") throw "\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07";
|
|
54
|
-
emit("complete", { secId: "" });
|
|
54
|
+
emit("complete", { secId: "", resetToken: res.data?.reset_token || res.data?.token || res.reset_token || res.token, password: password.value });
|
|
55
55
|
isOpen.value = false;
|
|
56
56
|
} else {
|
|
57
57
|
if (!props.loginToken) {
|
|
@@ -74,7 +74,8 @@ const handleSubmit = async () => {
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
} catch (e) {
|
|
77
|
-
|
|
77
|
+
const errorMsg = typeof e === "string" ? e : e?.data?.message?.description || "\u0E23\u0E2B\u0E31\u0E2A\u0E1C\u0E48\u0E32\u0E19\u0E44\u0E21\u0E48\u0E16\u0E39\u0E01\u0E15\u0E49\u0E2D\u0E07";
|
|
78
|
+
inputRef.value?.setErrors?.(errorMsg);
|
|
78
79
|
} finally {
|
|
79
80
|
loading.value = false;
|
|
80
81
|
}
|
|
@@ -18,12 +18,16 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_PublicProps, {},
|
|
|
18
18
|
"update:modelValue": (value: boolean) => any;
|
|
19
19
|
complete: (data: {
|
|
20
20
|
secId: string;
|
|
21
|
+
resetToken?: string;
|
|
22
|
+
password?: string;
|
|
21
23
|
}) => any;
|
|
22
24
|
}, string, import("vue").PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
23
25
|
onClose?: (() => any) | undefined;
|
|
24
26
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
25
27
|
onComplete?: ((data: {
|
|
26
28
|
secId: string;
|
|
29
|
+
resetToken?: string;
|
|
30
|
+
password?: string;
|
|
27
31
|
}) => any) | undefined;
|
|
28
32
|
}>, {
|
|
29
33
|
title: string;
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
mode="secure" @complete="(data) => handleComplete(modal.key, data)"
|
|
4
4
|
:confirmed-text="isLastStep ? '\u0E22\u0E37\u0E19\u0E22\u0E31\u0E19' : '\u0E16\u0E31\u0E14\u0E44\u0E1B'" @close="isOpen = false" v-model="modalStates[modal.key]"
|
|
5
5
|
:request-path="modal.key === 'phoneOTP' ? '/otp/phone-request' : void 0"
|
|
6
|
-
:verify-path="modal.key === 'phoneOTP' ? '/otp/phone-verify' : void 0"
|
|
6
|
+
:verify-path="modal.key === 'phoneOTP' ? '/otp/phone-verify' : void 0" :reset-token="resetTokenState"
|
|
7
|
+
:old-password="oldPasswordState"
|
|
8
|
+
:two-fa-code="twoFaCodeState" />
|
|
7
9
|
</template>
|
|
8
10
|
|
|
9
11
|
<script setup>
|
|
@@ -29,6 +31,9 @@ const isOpen = defineModel({ type: Boolean, ...{
|
|
|
29
31
|
default: false
|
|
30
32
|
} });
|
|
31
33
|
const isLastStep = ref(false);
|
|
34
|
+
const resetTokenState = ref("");
|
|
35
|
+
const oldPasswordState = ref("");
|
|
36
|
+
const twoFaCodeState = ref("");
|
|
32
37
|
const modals = [
|
|
33
38
|
{ key: "password", component: ModalPasswordVerify },
|
|
34
39
|
{ key: "passwordNew", component: ModalPasswordNew },
|
|
@@ -42,6 +47,15 @@ const modalStates = reactive(
|
|
|
42
47
|
);
|
|
43
48
|
const handleComplete = (key, data) => {
|
|
44
49
|
modalStates[key] = false;
|
|
50
|
+
if (data?.resetToken || data?.reset_token || data?.token) {
|
|
51
|
+
resetTokenState.value = data.resetToken || data.reset_token || data.token;
|
|
52
|
+
}
|
|
53
|
+
if (data?.password) {
|
|
54
|
+
oldPasswordState.value = data.password;
|
|
55
|
+
}
|
|
56
|
+
if (data?.code) {
|
|
57
|
+
twoFaCodeState.value = data.code;
|
|
58
|
+
}
|
|
45
59
|
if (props.state === "add-phone") {
|
|
46
60
|
if (key === "password") {
|
|
47
61
|
if (props.twoFaEnabled) {
|
|
@@ -167,6 +181,9 @@ const onDisabled2FA = async () => {
|
|
|
167
181
|
};
|
|
168
182
|
watch(isOpen, (v) => {
|
|
169
183
|
if (!v) return;
|
|
184
|
+
resetTokenState.value = "";
|
|
185
|
+
oldPasswordState.value = "";
|
|
186
|
+
twoFaCodeState.value = "";
|
|
170
187
|
modalStates.password = true;
|
|
171
188
|
if (["delete-phone", "delete-email"].includes(props.state)) {
|
|
172
189
|
isLastStep.value = !props.twoFaEnabled;
|
package/package.json
CHANGED
|
File without changes
|