@eeplatform/nuxt-layer-common 1.7.28 → 1.7.30
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 +12 -0
- package/components/EnrollmentForm.vue +620 -265
- package/components/Layout/Header.vue +2 -12
- package/composables/useEnrollment.ts +12 -2
- package/package.json +1 -1
- package/pages/forgot-password.vue +76 -0
- package/pages/login.vue +139 -0
- package/pages/logout.vue +34 -0
- package/pages/reset-password/[otp].vue +106 -0
- package/pages/sign-up/[id].vue +214 -0
- package/pages/sign-up/index.vue +142 -0
- package/pages/verify/invitation/[id].vue +164 -0
- package/pages/verify/member-invite/[id].vue +67 -0
- package/types/enrollment.d.ts +11 -1
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
rounded="xl"
|
|
187
187
|
variant="tonal"
|
|
188
188
|
size="x-large"
|
|
189
|
-
|
|
189
|
+
:to="{ name: 'logout' }"
|
|
190
190
|
class="text-none text-subtitle-1 font-weight-regular"
|
|
191
191
|
>
|
|
192
192
|
Logout
|
|
@@ -246,8 +246,7 @@ function setSearchValue() {
|
|
|
246
246
|
|
|
247
247
|
const { redirect, drawer } = useLocal();
|
|
248
248
|
|
|
249
|
-
const {
|
|
250
|
-
useRuntimeConfig().public;
|
|
249
|
+
const { APP_NAME, APP_NAME_ROUTE } = useRuntimeConfig().public;
|
|
251
250
|
|
|
252
251
|
const theme = useTheme();
|
|
253
252
|
|
|
@@ -261,15 +260,6 @@ const profile = computed(() => {
|
|
|
261
260
|
return `/api/public/${currentUser.value?.profile}`;
|
|
262
261
|
});
|
|
263
262
|
|
|
264
|
-
function logout() {
|
|
265
|
-
if (APP_NAME.toLowerCase() !== "main") {
|
|
266
|
-
redirect(`${APP_MAIN}/logout`);
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
useRouter().push({ name: "logout" });
|
|
271
|
-
}
|
|
272
|
-
|
|
273
263
|
const name = computed(() => {
|
|
274
264
|
let name = "";
|
|
275
265
|
if (currentUser.value?.firstName) {
|
|
@@ -25,7 +25,14 @@ export default function useEnrollment() {
|
|
|
25
25
|
lastName: "",
|
|
26
26
|
extensionName: "",
|
|
27
27
|
birthDate: "",
|
|
28
|
-
placeOfBirth:
|
|
28
|
+
placeOfBirth: {
|
|
29
|
+
region: "",
|
|
30
|
+
regionName: "",
|
|
31
|
+
province: "",
|
|
32
|
+
provinceName: "",
|
|
33
|
+
cityMunicipality: "",
|
|
34
|
+
cityMunicipalityName: "",
|
|
35
|
+
},
|
|
29
36
|
sex: "",
|
|
30
37
|
motherTongue: "",
|
|
31
38
|
age: 0,
|
|
@@ -60,8 +67,11 @@ export default function useEnrollment() {
|
|
|
60
67
|
streetName: "",
|
|
61
68
|
sitio: "",
|
|
62
69
|
barangay: "",
|
|
70
|
+
barangayName: "",
|
|
63
71
|
municipalityCity: "",
|
|
72
|
+
municipalityCityName: "",
|
|
64
73
|
province: "",
|
|
74
|
+
provinceName: "",
|
|
65
75
|
country: "",
|
|
66
76
|
zipCode: "",
|
|
67
77
|
},
|
|
@@ -91,7 +101,7 @@ export default function useEnrollment() {
|
|
|
91
101
|
},
|
|
92
102
|
remarks: "",
|
|
93
103
|
alternativeLearningOptions: [],
|
|
94
|
-
isCertifiedAndConsented:
|
|
104
|
+
isCertifiedAndConsented: false,
|
|
95
105
|
});
|
|
96
106
|
|
|
97
107
|
function add(value: TTLearner) {
|
package/package.json
CHANGED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row no-gutters class="fill-height" justify="center" align-content="center">
|
|
3
|
+
<v-col cols="12" class="mb-6">
|
|
4
|
+
<v-row no-gutters justify="center">
|
|
5
|
+
<nuxt-link
|
|
6
|
+
class="text-h2 font-weight-bold text-decoration-none"
|
|
7
|
+
style="color: unset"
|
|
8
|
+
:to="{ name: 'index' }"
|
|
9
|
+
>
|
|
10
|
+
EEPlatform
|
|
11
|
+
</nuxt-link>
|
|
12
|
+
</v-row>
|
|
13
|
+
</v-col>
|
|
14
|
+
|
|
15
|
+
<v-col cols="12" lg="3" md="4" sm="6">
|
|
16
|
+
<v-form v-model="isValid" @submit.prevent="submit(email)">
|
|
17
|
+
<v-row no-gutters>
|
|
18
|
+
<v-col cols="12">
|
|
19
|
+
<v-row no-gutters>
|
|
20
|
+
<v-col cols="12" class="text-h6 font-weight-bold"> Email </v-col>
|
|
21
|
+
<v-col cols="12">
|
|
22
|
+
<v-text-field
|
|
23
|
+
v-model="email"
|
|
24
|
+
:rules="[requiredRule, emailRule]"
|
|
25
|
+
></v-text-field>
|
|
26
|
+
</v-col>
|
|
27
|
+
</v-row>
|
|
28
|
+
</v-col>
|
|
29
|
+
|
|
30
|
+
<v-col v-if="message" cols="12" class="my-2 text-center font-italic">
|
|
31
|
+
{{ message }}
|
|
32
|
+
</v-col>
|
|
33
|
+
|
|
34
|
+
<v-col cols="12">
|
|
35
|
+
<v-row no-gutters justify="center">
|
|
36
|
+
<v-btn
|
|
37
|
+
type="submit"
|
|
38
|
+
variant="tonal"
|
|
39
|
+
:disabled="!isValid"
|
|
40
|
+
rounded="xl"
|
|
41
|
+
size="large"
|
|
42
|
+
>
|
|
43
|
+
submit
|
|
44
|
+
</v-btn>
|
|
45
|
+
</v-row>
|
|
46
|
+
</v-col>
|
|
47
|
+
|
|
48
|
+
<v-col cols="12" class="mt-2 text-center">
|
|
49
|
+
All good? <nuxt-link :to="{ name: 'index' }">Login</nuxt-link>
|
|
50
|
+
</v-col>
|
|
51
|
+
</v-row>
|
|
52
|
+
</v-form>
|
|
53
|
+
</v-col>
|
|
54
|
+
</v-row>
|
|
55
|
+
</template>
|
|
56
|
+
|
|
57
|
+
<script setup lang="ts">
|
|
58
|
+
definePageMeta({
|
|
59
|
+
layout: "plain",
|
|
60
|
+
});
|
|
61
|
+
const { requiredRule, emailRule } = useUtils();
|
|
62
|
+
const email = ref("");
|
|
63
|
+
const isValid = ref(false);
|
|
64
|
+
|
|
65
|
+
const { forgotPassword } = useLocalAuth();
|
|
66
|
+
const message = ref("");
|
|
67
|
+
|
|
68
|
+
async function submit(email = "") {
|
|
69
|
+
try {
|
|
70
|
+
const result: any = await forgotPassword(email);
|
|
71
|
+
message.value = result.message;
|
|
72
|
+
} catch (error: any) {
|
|
73
|
+
message.value = error.message;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
</script>
|
package/pages/login.vue
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row
|
|
3
|
+
no-gutters
|
|
4
|
+
class="fill-height pa-8"
|
|
5
|
+
justify="center"
|
|
6
|
+
align-content="center"
|
|
7
|
+
>
|
|
8
|
+
<v-col cols="12" lg="3" md="4" sm="6">
|
|
9
|
+
<v-form
|
|
10
|
+
v-model="isValid"
|
|
11
|
+
@submit.prevent="submit({ email, password })"
|
|
12
|
+
:disabled="loading"
|
|
13
|
+
>
|
|
14
|
+
<v-row no-gutters>
|
|
15
|
+
<v-col cols="12">
|
|
16
|
+
<v-row no-gutters justify="center">
|
|
17
|
+
<span
|
|
18
|
+
class="text-h4 text-sm-h4 text-md-h4 text-lg-h4 text-xl-h4 font-weight-bold text-decoration-none text-center"
|
|
19
|
+
>
|
|
20
|
+
E-Governance Ecosystem Platform
|
|
21
|
+
</span>
|
|
22
|
+
</v-row>
|
|
23
|
+
</v-col>
|
|
24
|
+
|
|
25
|
+
<v-col cols="12" class="mt-4">
|
|
26
|
+
<v-row no-gutters>
|
|
27
|
+
<v-col cols="12" class="text-h6 font-weight-bold"> Email </v-col>
|
|
28
|
+
<v-col cols="12">
|
|
29
|
+
<v-text-field
|
|
30
|
+
v-model="email"
|
|
31
|
+
:rules="[requiredRule, emailRule]"
|
|
32
|
+
></v-text-field>
|
|
33
|
+
</v-col>
|
|
34
|
+
</v-row>
|
|
35
|
+
</v-col>
|
|
36
|
+
|
|
37
|
+
<v-col cols="12">
|
|
38
|
+
<v-row no-gutters>
|
|
39
|
+
<v-col cols="12" class="text-h6 font-weight-bold">
|
|
40
|
+
Password
|
|
41
|
+
</v-col>
|
|
42
|
+
<v-col cols="12">
|
|
43
|
+
<InputPassword v-model="password" :rules="[requiredRule]" />
|
|
44
|
+
</v-col>
|
|
45
|
+
</v-row>
|
|
46
|
+
</v-col>
|
|
47
|
+
|
|
48
|
+
<v-col v-if="message" cols="12" class="my-2 text-center font-italic">
|
|
49
|
+
{{ message }}
|
|
50
|
+
</v-col>
|
|
51
|
+
|
|
52
|
+
<v-col cols="12" class="mt-4">
|
|
53
|
+
<v-row no-gutters justify="center">
|
|
54
|
+
<v-btn
|
|
55
|
+
block
|
|
56
|
+
type="submit"
|
|
57
|
+
variant="tonal"
|
|
58
|
+
:disabled="!isValid"
|
|
59
|
+
rounded="xl"
|
|
60
|
+
size="large"
|
|
61
|
+
class="text-none"
|
|
62
|
+
:loading="loading"
|
|
63
|
+
>
|
|
64
|
+
Login
|
|
65
|
+
</v-btn>
|
|
66
|
+
</v-row>
|
|
67
|
+
</v-col>
|
|
68
|
+
|
|
69
|
+
<v-col cols="12" class="text-center font-weight-bold mt-4">
|
|
70
|
+
<nuxt-link
|
|
71
|
+
:to="{ name: 'forgot-password' }"
|
|
72
|
+
class="text-decoration-none text-primary"
|
|
73
|
+
>
|
|
74
|
+
Forgot password?
|
|
75
|
+
</nuxt-link>
|
|
76
|
+
</v-col>
|
|
77
|
+
|
|
78
|
+
<v-col cols="12" class="my-4">
|
|
79
|
+
<v-divider></v-divider>
|
|
80
|
+
</v-col>
|
|
81
|
+
|
|
82
|
+
<v-col cols="12">
|
|
83
|
+
<v-row no-gutters justify="center">
|
|
84
|
+
<v-btn
|
|
85
|
+
block
|
|
86
|
+
variant="flat"
|
|
87
|
+
color="black"
|
|
88
|
+
rounded="xl"
|
|
89
|
+
size="large"
|
|
90
|
+
class="text-none"
|
|
91
|
+
:to="{ name: 'sign-up' }"
|
|
92
|
+
>
|
|
93
|
+
Create new account
|
|
94
|
+
</v-btn>
|
|
95
|
+
</v-row>
|
|
96
|
+
</v-col>
|
|
97
|
+
</v-row>
|
|
98
|
+
</v-form>
|
|
99
|
+
</v-col>
|
|
100
|
+
</v-row>
|
|
101
|
+
</template>
|
|
102
|
+
|
|
103
|
+
<script setup lang="ts">
|
|
104
|
+
definePageMeta({
|
|
105
|
+
layout: "plain",
|
|
106
|
+
});
|
|
107
|
+
const { requiredRule, emailRule } = useUtils();
|
|
108
|
+
const email = ref("");
|
|
109
|
+
const password = ref("");
|
|
110
|
+
const isValid = ref(false);
|
|
111
|
+
|
|
112
|
+
const { login, setSession } = useLocalAuth();
|
|
113
|
+
|
|
114
|
+
const { redirect, landingPage } = useLocal();
|
|
115
|
+
|
|
116
|
+
const APP_ACCOUNT = useRuntimeConfig().public.APP_ACCOUNT;
|
|
117
|
+
|
|
118
|
+
const message = ref("");
|
|
119
|
+
|
|
120
|
+
const loading = ref(false);
|
|
121
|
+
|
|
122
|
+
async function submit({ email = "", password = "" } = {}) {
|
|
123
|
+
loading.value = true;
|
|
124
|
+
try {
|
|
125
|
+
await login({ email, password });
|
|
126
|
+
|
|
127
|
+
if (landingPage.value) {
|
|
128
|
+
await redirect(landingPage.value);
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
await redirect(APP_ACCOUNT, "home");
|
|
133
|
+
} catch (error: any) {
|
|
134
|
+
message.value = error.data.message;
|
|
135
|
+
} finally {
|
|
136
|
+
loading.value = false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
</script>
|
package/pages/logout.vue
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row no-gutters class="fill-height" justify="center" align-content="center">
|
|
3
|
+
<v-col cols="12" class="mt-2 text-center font-weight-bold">
|
|
4
|
+
You have been logged out.
|
|
5
|
+
<nuxt-link :to="{ name: 'index' }">Login</nuxt-link>
|
|
6
|
+
</v-col>
|
|
7
|
+
</v-row>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script setup lang="ts">
|
|
11
|
+
definePageMeta({
|
|
12
|
+
layout: "plain",
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const { cookieConfig } = useLocal();
|
|
16
|
+
|
|
17
|
+
useCookie("sid", cookieConfig).value = null;
|
|
18
|
+
useCookie("user", cookieConfig).value = null;
|
|
19
|
+
useCookie("role", cookieConfig).value = null;
|
|
20
|
+
useCookie("org", cookieConfig).value = null;
|
|
21
|
+
|
|
22
|
+
const sid = useCookie("sid", cookieConfig).value;
|
|
23
|
+
if (sid) {
|
|
24
|
+
try {
|
|
25
|
+
useLazyAsyncData("logout", () =>
|
|
26
|
+
useNuxtApp().$api(`/api/auth/${sid}`, {
|
|
27
|
+
method: "DELETE",
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error("Logout failed:", error);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
</script>
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row no-gutters class="fill-height" justify="center" align-content="center">
|
|
3
|
+
<v-col cols="12" lg="3" md="4" sm="6">
|
|
4
|
+
<v-form
|
|
5
|
+
v-model="isValid"
|
|
6
|
+
@submit.prevent="submit(otp, newPassword, confirmPassword)"
|
|
7
|
+
>
|
|
8
|
+
<v-row no-gutters>
|
|
9
|
+
<v-col cols="12">
|
|
10
|
+
<v-row no-gutters justify="center">
|
|
11
|
+
<nuxt-link
|
|
12
|
+
class="text-h2 font-weight-bold text-decoration-none"
|
|
13
|
+
style="color: unset"
|
|
14
|
+
:to="{ name: 'index' }"
|
|
15
|
+
>
|
|
16
|
+
EEPlatform
|
|
17
|
+
</nuxt-link>
|
|
18
|
+
</v-row>
|
|
19
|
+
</v-col>
|
|
20
|
+
|
|
21
|
+
<v-col cols="12" class="mt-6">
|
|
22
|
+
<v-row no-gutters>
|
|
23
|
+
<v-col cols="12" class="text-h6 font-weight-bold">
|
|
24
|
+
New Password
|
|
25
|
+
</v-col>
|
|
26
|
+
<v-col cols="12">
|
|
27
|
+
<InputPassword
|
|
28
|
+
id="newPassword"
|
|
29
|
+
v-model="newPassword"
|
|
30
|
+
:rules="[requiredRule, passwordRule]"
|
|
31
|
+
/>
|
|
32
|
+
</v-col>
|
|
33
|
+
</v-row>
|
|
34
|
+
</v-col>
|
|
35
|
+
|
|
36
|
+
<v-col cols="12">
|
|
37
|
+
<v-row no-gutters>
|
|
38
|
+
<v-col cols="12" class="text-h6 font-weight-bold">
|
|
39
|
+
Confirm New Password
|
|
40
|
+
</v-col>
|
|
41
|
+
<v-col cols="12">
|
|
42
|
+
<InputPassword
|
|
43
|
+
id="confirmPassword"
|
|
44
|
+
v-model="confirmPassword"
|
|
45
|
+
:rules="[requiredRule, passwordRule]"
|
|
46
|
+
:errorMessages="
|
|
47
|
+
confirmPassword && newPassword !== confirmPassword
|
|
48
|
+
? 'Password mismatch!'
|
|
49
|
+
: ''
|
|
50
|
+
"
|
|
51
|
+
/>
|
|
52
|
+
</v-col>
|
|
53
|
+
</v-row>
|
|
54
|
+
</v-col>
|
|
55
|
+
|
|
56
|
+
<v-col v-if="message" cols="12" class="my-2 font-italic text-center">
|
|
57
|
+
{{ message }}
|
|
58
|
+
</v-col>
|
|
59
|
+
|
|
60
|
+
<v-col cols="12">
|
|
61
|
+
<v-row no-gutters justify="center">
|
|
62
|
+
<v-btn
|
|
63
|
+
type="submit"
|
|
64
|
+
variant="tonal"
|
|
65
|
+
:disabled="!isValid"
|
|
66
|
+
rounded="xl"
|
|
67
|
+
size="large"
|
|
68
|
+
>
|
|
69
|
+
submit
|
|
70
|
+
</v-btn>
|
|
71
|
+
</v-row>
|
|
72
|
+
</v-col>
|
|
73
|
+
|
|
74
|
+
<v-col cols="12" class="mt-6 text-center">
|
|
75
|
+
All good?
|
|
76
|
+
<nuxt-link :to="{ name: 'login' }">Sign in</nuxt-link>
|
|
77
|
+
</v-col>
|
|
78
|
+
</v-row>
|
|
79
|
+
</v-form>
|
|
80
|
+
</v-col>
|
|
81
|
+
</v-row>
|
|
82
|
+
</template>
|
|
83
|
+
|
|
84
|
+
<script setup lang="ts">
|
|
85
|
+
definePageMeta({
|
|
86
|
+
layout: "plain",
|
|
87
|
+
});
|
|
88
|
+
const { requiredRule, passwordRule } = useUtils();
|
|
89
|
+
const newPassword = ref("");
|
|
90
|
+
const confirmPassword = ref("");
|
|
91
|
+
const isValid = ref(false);
|
|
92
|
+
const otp = (useRoute().params.otp as string) ?? "";
|
|
93
|
+
|
|
94
|
+
const { resetPassword } = useLocalAuth();
|
|
95
|
+
|
|
96
|
+
const message = ref("");
|
|
97
|
+
|
|
98
|
+
async function submit(otp = "", newPassword = "", confirmPassword = "") {
|
|
99
|
+
try {
|
|
100
|
+
const result: any = await resetPassword(otp, newPassword, confirmPassword);
|
|
101
|
+
message.value = result.message;
|
|
102
|
+
} catch (error: any) {
|
|
103
|
+
message.value = error.data.message;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
</script>
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row no-gutters class="fill-height" justify="center" align-content="center">
|
|
3
|
+
<v-col cols="12" class="mb-6">
|
|
4
|
+
<v-row no-gutters justify="center">
|
|
5
|
+
<nuxt-link
|
|
6
|
+
class="text-h2 font-weight-bold text-decoration-none"
|
|
7
|
+
style="color: unset"
|
|
8
|
+
:to="{ name: 'index' }"
|
|
9
|
+
>
|
|
10
|
+
EEPlatform
|
|
11
|
+
</nuxt-link>
|
|
12
|
+
</v-row>
|
|
13
|
+
</v-col>
|
|
14
|
+
|
|
15
|
+
<v-col
|
|
16
|
+
v-if="validating"
|
|
17
|
+
cols="12"
|
|
18
|
+
class="text-subtitle-1 font-weight-medium text-center font-italic"
|
|
19
|
+
>
|
|
20
|
+
{{ message }}
|
|
21
|
+
</v-col>
|
|
22
|
+
<v-col v-else cols="12" lg="3" md="4" sm="6">
|
|
23
|
+
<v-row no-gutters>
|
|
24
|
+
<v-col v-if="validInvitation" cols="12">
|
|
25
|
+
<v-form
|
|
26
|
+
v-model="isValid"
|
|
27
|
+
@submit.prevent="
|
|
28
|
+
submit({ firstName, lastName, password, id, referralCode, type })
|
|
29
|
+
"
|
|
30
|
+
id="form1"
|
|
31
|
+
autocomplete="off"
|
|
32
|
+
:disabled="isFormDisabled"
|
|
33
|
+
>
|
|
34
|
+
<v-row no-gutters>
|
|
35
|
+
<v-col cols="12">
|
|
36
|
+
<v-row no-gutters>
|
|
37
|
+
<InputLabel
|
|
38
|
+
class="text-capitalize"
|
|
39
|
+
title="First Name"
|
|
40
|
+
required
|
|
41
|
+
/>
|
|
42
|
+
<v-col cols="12">
|
|
43
|
+
<v-text-field
|
|
44
|
+
v-model="firstName"
|
|
45
|
+
density="comfortable"
|
|
46
|
+
:rules="[requiredRule]"
|
|
47
|
+
></v-text-field>
|
|
48
|
+
</v-col>
|
|
49
|
+
</v-row>
|
|
50
|
+
</v-col>
|
|
51
|
+
|
|
52
|
+
<v-col cols="12" class="mt-2">
|
|
53
|
+
<v-row no-gutters>
|
|
54
|
+
<InputLabel
|
|
55
|
+
class="text-capitalize"
|
|
56
|
+
title="Last Name"
|
|
57
|
+
required
|
|
58
|
+
/>
|
|
59
|
+
<v-col cols="12">
|
|
60
|
+
<v-text-field
|
|
61
|
+
v-model="lastName"
|
|
62
|
+
density="comfortable"
|
|
63
|
+
:rules="[requiredRule]"
|
|
64
|
+
></v-text-field>
|
|
65
|
+
</v-col>
|
|
66
|
+
</v-row>
|
|
67
|
+
</v-col>
|
|
68
|
+
|
|
69
|
+
<v-col cols="12">
|
|
70
|
+
<v-row no-gutters>
|
|
71
|
+
<InputLabel
|
|
72
|
+
class="text-capitalize"
|
|
73
|
+
title="Password"
|
|
74
|
+
required
|
|
75
|
+
/>
|
|
76
|
+
<v-col cols="12">
|
|
77
|
+
<InputPassword v-model="password" :rules="[requiredRule]" />
|
|
78
|
+
</v-col>
|
|
79
|
+
</v-row>
|
|
80
|
+
</v-col>
|
|
81
|
+
|
|
82
|
+
<v-col
|
|
83
|
+
v-if="message"
|
|
84
|
+
cols="12"
|
|
85
|
+
:class="'my-2 text-center font-italic' + msgColor"
|
|
86
|
+
>
|
|
87
|
+
{{ message }}
|
|
88
|
+
</v-col>
|
|
89
|
+
|
|
90
|
+
<v-col cols="12" v-if="!isFormDisabled">
|
|
91
|
+
<v-btn
|
|
92
|
+
block
|
|
93
|
+
type="submit"
|
|
94
|
+
variant="text"
|
|
95
|
+
:disabled="!isValid"
|
|
96
|
+
rounded="xl"
|
|
97
|
+
size="large"
|
|
98
|
+
:loading="loading"
|
|
99
|
+
>
|
|
100
|
+
submit
|
|
101
|
+
</v-btn>
|
|
102
|
+
</v-col>
|
|
103
|
+
</v-row>
|
|
104
|
+
</v-form>
|
|
105
|
+
</v-col>
|
|
106
|
+
|
|
107
|
+
<v-col
|
|
108
|
+
v-else
|
|
109
|
+
cols="12"
|
|
110
|
+
class="text-subtitle-1 font-weight-medium text-center font-italic"
|
|
111
|
+
>
|
|
112
|
+
<span>{{ message }}</span>
|
|
113
|
+
<v-row no-gutters justify="center">
|
|
114
|
+
<nuxt-link :to="{ name: 'index' }">Go to homepage</nuxt-link>
|
|
115
|
+
</v-row>
|
|
116
|
+
</v-col>
|
|
117
|
+
</v-row>
|
|
118
|
+
</v-col>
|
|
119
|
+
</v-row>
|
|
120
|
+
</template>
|
|
121
|
+
|
|
122
|
+
<script setup lang="ts">
|
|
123
|
+
definePageMeta({
|
|
124
|
+
layout: "plain",
|
|
125
|
+
});
|
|
126
|
+
const { verify } = useLocalAuth();
|
|
127
|
+
|
|
128
|
+
const id = (useRoute().params.id as string) ?? "";
|
|
129
|
+
|
|
130
|
+
const validating = ref(true);
|
|
131
|
+
const validInvitation = ref(false);
|
|
132
|
+
|
|
133
|
+
const message = ref("Validating invitation...");
|
|
134
|
+
const msgColor = ref("text-error");
|
|
135
|
+
|
|
136
|
+
const type = ref("");
|
|
137
|
+
const referralCode = ref("");
|
|
138
|
+
const loading = ref(false);
|
|
139
|
+
|
|
140
|
+
async function validate() {
|
|
141
|
+
try {
|
|
142
|
+
const result = await verify(id);
|
|
143
|
+
|
|
144
|
+
if (result.type) {
|
|
145
|
+
type.value = result.type;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
if (result.referralCode) {
|
|
149
|
+
referralCode.value = result.referralCode;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
validInvitation.value = true;
|
|
153
|
+
message.value = "";
|
|
154
|
+
} catch (error: any) {
|
|
155
|
+
message.value = error.data.message;
|
|
156
|
+
}
|
|
157
|
+
validating.value = false;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
await validate();
|
|
161
|
+
|
|
162
|
+
const { requiredRule } = useUtils();
|
|
163
|
+
const firstName = ref("");
|
|
164
|
+
const lastName = ref("");
|
|
165
|
+
const password = ref("");
|
|
166
|
+
|
|
167
|
+
const isValid = ref(false);
|
|
168
|
+
|
|
169
|
+
const { createUserByVerification } = useUser();
|
|
170
|
+
|
|
171
|
+
const countdown = ref(5); // Countdown from 5 seconds
|
|
172
|
+
const isFormDisabled = ref(false);
|
|
173
|
+
|
|
174
|
+
async function submit({
|
|
175
|
+
firstName = "",
|
|
176
|
+
lastName = "",
|
|
177
|
+
password = "",
|
|
178
|
+
id = "",
|
|
179
|
+
type = "",
|
|
180
|
+
referralCode = "",
|
|
181
|
+
} = {}) {
|
|
182
|
+
message.value = "";
|
|
183
|
+
loading.value = true;
|
|
184
|
+
try {
|
|
185
|
+
const res = await createUserByVerification({
|
|
186
|
+
firstName,
|
|
187
|
+
lastName,
|
|
188
|
+
password,
|
|
189
|
+
id,
|
|
190
|
+
type,
|
|
191
|
+
referralCode,
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
isFormDisabled.value = true;
|
|
195
|
+
|
|
196
|
+
msgColor.value = " text-none";
|
|
197
|
+
|
|
198
|
+
message.value = `${res.message} Redirecting in ${countdown.value} seconds...`;
|
|
199
|
+
|
|
200
|
+
// Start countdown
|
|
201
|
+
const interval = setInterval(() => {
|
|
202
|
+
countdown.value--;
|
|
203
|
+
message.value = `${res.message} Redirecting in ${countdown.value} seconds...`;
|
|
204
|
+
if (countdown.value <= 0) {
|
|
205
|
+
clearInterval(interval);
|
|
206
|
+
navigateTo({ name: "index" });
|
|
207
|
+
}
|
|
208
|
+
}, 1000);
|
|
209
|
+
} catch (error: any) {
|
|
210
|
+
message.value = error.data.message;
|
|
211
|
+
}
|
|
212
|
+
loading.value = false;
|
|
213
|
+
}
|
|
214
|
+
</script>
|