@icvdeveloper/common-module 2.4.1 → 2.5.1
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 +4 -0
- package/dist/module.json +1 -1
- package/dist/runtime/components/auth/LoginFullWidth.vue +15 -5
- package/dist/runtime/components/auth/PasswordReset.vue +37 -22
- package/dist/runtime/components/auth/PasswordResetRequest.vue +98 -0
- package/dist/runtime/components/core/Navigation.vue +1 -1
- package/dist/runtime/components/forms/TextInput.vue +1 -1
- package/dist/runtime/store/auth.d.ts +2 -1
- package/dist/runtime/store/auth.mjs +19 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/module.json
CHANGED
|
@@ -8,22 +8,24 @@ import { usePortalStore } from "../../store";
|
|
|
8
8
|
|
|
9
9
|
interface Props {
|
|
10
10
|
title?: string | null;
|
|
11
|
+
message?: string | null;
|
|
11
12
|
conference?: Conference | null;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
const props = withDefaults(defineProps<Props>(), {
|
|
15
16
|
title: null,
|
|
17
|
+
message: null,
|
|
16
18
|
conference: null,
|
|
17
19
|
});
|
|
18
20
|
|
|
19
|
-
const { title, conference } = toRefs<Props>(props);
|
|
21
|
+
const { title, message, conference } = toRefs<Props>(props);
|
|
20
22
|
|
|
21
23
|
const { data:portal } = storeToRefs(usePortalStore());
|
|
22
24
|
const { globalConfigValue } = storeToRefs(useTemplateConfigsStore());
|
|
23
25
|
|
|
24
26
|
// emits
|
|
25
27
|
const emit = defineEmits<{
|
|
26
|
-
(event: "
|
|
28
|
+
(event: "showResetRequest"): void;
|
|
27
29
|
|
|
28
30
|
}>();
|
|
29
31
|
|
|
@@ -31,8 +33,8 @@ const emit = defineEmits<{
|
|
|
31
33
|
const { loginError, handleLogin, email, password, tooManySessions } =
|
|
32
34
|
useLogin(conference);
|
|
33
35
|
|
|
34
|
-
const
|
|
35
|
-
emit("
|
|
36
|
+
const showResetRequest = () => {
|
|
37
|
+
emit("showResetRequest");
|
|
36
38
|
};
|
|
37
39
|
|
|
38
40
|
</script>
|
|
@@ -49,6 +51,14 @@ const showReset = () => {
|
|
|
49
51
|
<h1 class="mb-3 heading-color-3">
|
|
50
52
|
Log In
|
|
51
53
|
</h1>
|
|
54
|
+
<!-- message -->
|
|
55
|
+
<CommonMessage
|
|
56
|
+
v-if="message && !loginError"
|
|
57
|
+
:success="true"
|
|
58
|
+
class="w-full max-w-xs mx-auto"
|
|
59
|
+
>
|
|
60
|
+
{{ message }}
|
|
61
|
+
</CommonMessage>
|
|
52
62
|
<!-- error messages -->
|
|
53
63
|
<CommonMessage
|
|
54
64
|
v-if="loginError"
|
|
@@ -60,7 +70,7 @@ const showReset = () => {
|
|
|
60
70
|
<a
|
|
61
71
|
v-if="portal.is_virtual_template || globalConfigValue('secure_site_access_enabled', false)"
|
|
62
72
|
class="cursor-pointer"
|
|
63
|
-
@click="
|
|
73
|
+
@click="showResetRequest"
|
|
64
74
|
>
|
|
65
75
|
Forgot Your Password?
|
|
66
76
|
</a>
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
2
|
import { ref, toRefs } from "vue";
|
|
3
|
+
import { useRoute } from "vue-router";
|
|
4
|
+
import { forIn } from 'lodash-es';
|
|
3
5
|
import { useAuthStore } from "../../store/auth";
|
|
4
6
|
import type { TextInputClassObj } from "../../@types/components";
|
|
5
7
|
import { useClassBinding } from "../../composables/useClassBinding";
|
|
@@ -20,31 +22,44 @@ const props = withDefaults(defineProps<Props>(), {
|
|
|
20
22
|
},
|
|
21
23
|
});
|
|
22
24
|
|
|
25
|
+
// emits
|
|
26
|
+
const emit = defineEmits<{
|
|
27
|
+
(event: 'showLogin', value: string): void
|
|
28
|
+
}>();
|
|
29
|
+
|
|
23
30
|
// data
|
|
31
|
+
const route = useRoute();
|
|
32
|
+
const { passwordReset } = useAuthStore();
|
|
33
|
+
|
|
24
34
|
const { isCentered } = toRefs(props);
|
|
25
35
|
const { classBinding } = useClassBinding();
|
|
26
36
|
|
|
27
37
|
const loading = ref<boolean>(false);
|
|
38
|
+
const token = ref<string>("");
|
|
28
39
|
const email = ref<string>("");
|
|
40
|
+
const password = ref<string>("");
|
|
41
|
+
const password_confirmation = ref<string>("");
|
|
29
42
|
const message = ref<null | string>(null);
|
|
30
43
|
const errors = ref<Array<any>>([]);
|
|
31
44
|
|
|
32
45
|
// methods
|
|
33
|
-
const { passwordReset } = useAuthStore();
|
|
34
46
|
const submitPasswordReset = () => {
|
|
35
47
|
loading.value = true;
|
|
36
48
|
message.value = null;
|
|
37
49
|
errors.value = [];
|
|
38
|
-
|
|
50
|
+
token.value = route.params.token;
|
|
51
|
+
passwordReset(email.value, password.value, password_confirmation.value, token.value)
|
|
39
52
|
.then((response) => {
|
|
40
53
|
message.value = response.message;
|
|
54
|
+
emit("showLogin", message.value);
|
|
41
55
|
})
|
|
42
56
|
.catch((error) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
57
|
+
if (error.response?._data?.errors) {
|
|
58
|
+
forIn(error.response._data.errors, function(obj, key) {
|
|
59
|
+
errors.value = errors.value.concat(obj);
|
|
60
|
+
});
|
|
46
61
|
} else {
|
|
47
|
-
errors.value = ["Error
|
|
62
|
+
errors.value = ["Error resetting password."];
|
|
48
63
|
}
|
|
49
64
|
})
|
|
50
65
|
.finally(() => {
|
|
@@ -59,7 +74,7 @@ const submitPasswordReset = () => {
|
|
|
59
74
|
class="pt-8"
|
|
60
75
|
>
|
|
61
76
|
<div class="mb-4">
|
|
62
|
-
|
|
77
|
+
Please enter your email address and new password in order to reset your password.
|
|
63
78
|
</div>
|
|
64
79
|
<CommonMessage
|
|
65
80
|
v-if="message"
|
|
@@ -71,27 +86,27 @@ const submitPasswordReset = () => {
|
|
|
71
86
|
v-if="errors.length > 0"
|
|
72
87
|
:success="false"
|
|
73
88
|
>
|
|
74
|
-
{{ errors
|
|
89
|
+
{{ errors.join(" ") }}
|
|
75
90
|
</CommonMessage>
|
|
76
|
-
<div
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
91
|
+
<div
|
|
92
|
+
v-if="!message"
|
|
93
|
+
@keyup.enter="submitPasswordReset()"
|
|
94
|
+
>
|
|
95
|
+
<div class="py-2">
|
|
96
|
+
<input type="email" id="email" placeholder="Email" class="form-input" v-model="email" required>
|
|
97
|
+
</div>
|
|
98
|
+
<div class="py-2">
|
|
99
|
+
<input type="password" id="password" class="form-input" placeholder="Password" v-model="password" required>
|
|
100
|
+
</div>
|
|
101
|
+
<div class="py-2">
|
|
102
|
+
<input type="password" id="password_confirmation" class="form-input" placeholder="Confirm Password" v-model="password_confirmation" required>
|
|
103
|
+
</div>
|
|
89
104
|
<button
|
|
90
105
|
class="btn my-2"
|
|
91
106
|
@click="submitPasswordReset()"
|
|
92
107
|
>
|
|
93
108
|
<span v-if="loading">Processing...</span>
|
|
94
|
-
<span v-else>
|
|
109
|
+
<span v-else>Update Password</span>
|
|
95
110
|
</button>
|
|
96
111
|
</div>
|
|
97
112
|
</div>
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ref, toRefs } from "vue";
|
|
3
|
+
import { useAuthStore } from "../../store/auth";
|
|
4
|
+
import type { TextInputClassObj } from "../../@types/components";
|
|
5
|
+
import { useClassBinding } from "../../composables/useClassBinding";
|
|
6
|
+
|
|
7
|
+
interface Props {
|
|
8
|
+
isCentered?: boolean;
|
|
9
|
+
classObject?: TextInputClassObj;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
13
|
+
isCentered: false,
|
|
14
|
+
classObject: () => {
|
|
15
|
+
return {
|
|
16
|
+
classObject: ref<TextInputClassObj>({
|
|
17
|
+
container: "",
|
|
18
|
+
}),
|
|
19
|
+
};
|
|
20
|
+
},
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
// data
|
|
24
|
+
const { isCentered } = toRefs(props);
|
|
25
|
+
const { classBinding } = useClassBinding();
|
|
26
|
+
|
|
27
|
+
const loading = ref<boolean>(false);
|
|
28
|
+
const email = ref<string>("");
|
|
29
|
+
const message = ref<null | string>(null);
|
|
30
|
+
const errors = ref<Array<any>>([]);
|
|
31
|
+
|
|
32
|
+
// methods
|
|
33
|
+
const { passwordResetRequest } = useAuthStore();
|
|
34
|
+
const submitPasswordResetRequest = () => {
|
|
35
|
+
loading.value = true;
|
|
36
|
+
message.value = null;
|
|
37
|
+
errors.value = [];
|
|
38
|
+
passwordResetRequest(email.value)
|
|
39
|
+
.then((response) => {
|
|
40
|
+
message.value = response.message;
|
|
41
|
+
})
|
|
42
|
+
.catch((error) => {
|
|
43
|
+
if (error.response.status === 401 && error.response?._data?.errors?.email) {
|
|
44
|
+
errors.value = error.response?._data?.errors?.email;
|
|
45
|
+
} else {
|
|
46
|
+
errors.value = ["Error requesting password reset."];
|
|
47
|
+
}
|
|
48
|
+
})
|
|
49
|
+
.finally(() => {
|
|
50
|
+
loading.value = false;
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<template>
|
|
57
|
+
<div
|
|
58
|
+
:class="isCentered ? 'w-full max-w-xs mx-auto text-center' : ''"
|
|
59
|
+
class="pt-8"
|
|
60
|
+
>
|
|
61
|
+
<div class="mb-4">
|
|
62
|
+
Enter your email address to reset your password.
|
|
63
|
+
</div>
|
|
64
|
+
<CommonMessage
|
|
65
|
+
v-if="message"
|
|
66
|
+
:success="true"
|
|
67
|
+
>
|
|
68
|
+
{{ message }}
|
|
69
|
+
</CommonMessage>
|
|
70
|
+
<CommonMessage
|
|
71
|
+
v-if="errors.length > 0"
|
|
72
|
+
:success="false"
|
|
73
|
+
>
|
|
74
|
+
{{ errors[0] }}
|
|
75
|
+
</CommonMessage>
|
|
76
|
+
<div @keyup.enter="submitPasswordResetRequest()">
|
|
77
|
+
<CommonTextInput
|
|
78
|
+
v-model="email"
|
|
79
|
+
placeholder="Email"
|
|
80
|
+
type="email"
|
|
81
|
+
:class="
|
|
82
|
+
classBinding(
|
|
83
|
+
classObject,
|
|
84
|
+
'container',
|
|
85
|
+
'contrast-border mb-2'
|
|
86
|
+
)
|
|
87
|
+
"
|
|
88
|
+
/>
|
|
89
|
+
<button
|
|
90
|
+
class="btn my-2"
|
|
91
|
+
@click="submitPasswordResetRequest()"
|
|
92
|
+
>
|
|
93
|
+
<span v-if="loading">Processing...</span>
|
|
94
|
+
<span v-else>Send Password Reset Link</span>
|
|
95
|
+
</button>
|
|
96
|
+
</div>
|
|
97
|
+
</div>
|
|
98
|
+
</template>
|
|
@@ -106,7 +106,7 @@ const isSearchEnabled = computed((): boolean => {
|
|
|
106
106
|
// methods
|
|
107
107
|
const emitLoginModal = (): void => {
|
|
108
108
|
const modalContent: ContentData = {};
|
|
109
|
-
modalContent.contentType = '
|
|
109
|
+
modalContent.contentType = 'login';
|
|
110
110
|
modalContentEventHook.trigger(modalContent);
|
|
111
111
|
};
|
|
112
112
|
|
|
@@ -33,7 +33,7 @@ const { classObject } = toRefs(props);
|
|
|
33
33
|
|
|
34
34
|
<template>
|
|
35
35
|
<input
|
|
36
|
-
:class="classBinding(classObject, 'container', 'form-input
|
|
36
|
+
:class="classBinding(classObject, 'container', 'form-input')"
|
|
37
37
|
:type="type"
|
|
38
38
|
:value="props.modelValue"
|
|
39
39
|
:placeholder="placeholder"
|
|
@@ -11,5 +11,6 @@ export declare const useAuthStore: import("pinia").StoreDefinition<"auth", AuthS
|
|
|
11
11
|
login(params: LoginParams): Promise<AuthUser>;
|
|
12
12
|
logout(): Promise<void>;
|
|
13
13
|
update(data: AuthUser): Promise<void>;
|
|
14
|
-
|
|
14
|
+
passwordResetRequest(email: string): Promise<any>;
|
|
15
|
+
passwordReset(email: string, password: string, password_confirmation: string, token: string): Promise<any>;
|
|
15
16
|
}>;
|
|
@@ -103,7 +103,7 @@ export const useAuthStore = defineStore("auth", {
|
|
|
103
103
|
}
|
|
104
104
|
});
|
|
105
105
|
},
|
|
106
|
-
|
|
106
|
+
passwordResetRequest(email) {
|
|
107
107
|
return new Promise((resolve, reject) => {
|
|
108
108
|
const request = useApi();
|
|
109
109
|
request("portal-send-password-reset", {
|
|
@@ -115,6 +115,24 @@ export const useAuthStore = defineStore("auth", {
|
|
|
115
115
|
reject(error);
|
|
116
116
|
});
|
|
117
117
|
});
|
|
118
|
+
},
|
|
119
|
+
passwordReset(email, password, password_confirmation, token) {
|
|
120
|
+
return new Promise((resolve, reject) => {
|
|
121
|
+
const request = useApi();
|
|
122
|
+
request("portal-reset-password", {
|
|
123
|
+
method: "POST",
|
|
124
|
+
body: {
|
|
125
|
+
email,
|
|
126
|
+
password,
|
|
127
|
+
password_confirmation,
|
|
128
|
+
token
|
|
129
|
+
}
|
|
130
|
+
}).then((response) => {
|
|
131
|
+
resolve(response);
|
|
132
|
+
}).catch((error) => {
|
|
133
|
+
reject(error);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
118
136
|
}
|
|
119
137
|
}
|
|
120
138
|
});
|