@icvdeveloper/common-module 2.4.0 → 2.5.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/CHANGELOG.md CHANGED
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## Unreleased
9
9
 
10
+ ## 2.5.0 - 2025-07-17
11
+
12
+ ## 2.4.1 - 2025-07-02
13
+
10
14
  ## 2.4.0 - 2025-07-02
11
15
 
12
16
  ## 2.3.8 - 2025-06-11
package/dist/module.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "name": "v3plus-common-module",
3
3
  "configKey": "v3plusCommonModule",
4
- "version": "2.4.0"
4
+ "version": "2.5.0"
5
5
  }
@@ -4,6 +4,7 @@ import { storeToRefs } from "pinia";
4
4
  import type { Conference } from "../../models/conference";
5
5
  import { useLogin } from "../../composables/useLogin";
6
6
  import { useTemplateConfigsStore } from "../../store";
7
+ import { usePortalStore } from "../../store";
7
8
 
8
9
  interface Props {
9
10
  title?: string | null;
@@ -17,11 +18,23 @@ const props = withDefaults(defineProps<Props>(), {
17
18
 
18
19
  const { title, conference } = toRefs<Props>(props);
19
20
 
21
+ const { data:portal } = storeToRefs(usePortalStore());
20
22
  const { globalConfigValue } = storeToRefs(useTemplateConfigsStore());
21
23
 
24
+ // emits
25
+ const emit = defineEmits<{
26
+ (event: "showResetRequest"): void;
27
+
28
+ }>();
29
+
22
30
  // Methods
23
- const { loginError, handleLogin, email, password, tooManySessions, showReset } =
31
+ const { loginError, handleLogin, email, password, tooManySessions } =
24
32
  useLogin(conference);
33
+
34
+ const showResetRequest = () => {
35
+ emit("showResetRequest");
36
+ };
37
+
25
38
  </script>
26
39
 
27
40
  <template>
@@ -45,15 +58,15 @@ const { loginError, handleLogin, email, password, tooManySessions, showReset } =
45
58
  Invalid email or password.
46
59
  <br>
47
60
  <a
48
- v-if="!globalConfigValue('secure_site_access_enabled', false)"
49
- href="/login/email"
61
+ v-if="portal.is_virtual_template || globalConfigValue('secure_site_access_enabled', false)"
62
+ class="cursor-pointer"
63
+ @click="showResetRequest"
50
64
  >
51
65
  Forgot Your Password?
52
66
  </a>
53
67
  <a
54
- v-if="globalConfigValue('secure_site_access_enabled', false)"
55
- class="cursor-pointer"
56
- @click="showReset"
68
+ v-else
69
+ href="/login/email"
57
70
  >
58
71
  Forgot Your Password?
59
72
  </a>
@@ -1,37 +1,60 @@
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";
6
+ import type { TextInputClassObj } from "../../@types/components";
7
+ import { useClassBinding } from "../../composables/useClassBinding";
4
8
 
5
9
  interface Props {
6
10
  isCentered?: boolean;
11
+ classObject?: TextInputClassObj;
7
12
  }
8
13
 
9
14
  const props = withDefaults(defineProps<Props>(), {
10
15
  isCentered: false,
16
+ classObject: () => {
17
+ return {
18
+ classObject: ref<TextInputClassObj>({
19
+ container: "",
20
+ }),
21
+ };
22
+ },
11
23
  });
12
24
 
13
25
  // data
26
+ const route = useRoute();
27
+
14
28
  const { isCentered } = toRefs(props);
29
+ const { classBinding } = useClassBinding();
30
+
15
31
  const loading = ref<boolean>(false);
32
+ const token = ref<string>("");
16
33
  const email = ref<string>("");
34
+ const password = ref<string>("");
35
+ const password_confirmation = ref<string>("");
17
36
  const message = ref<null | string>(null);
18
37
  const errors = ref<Array<any>>([]);
19
38
 
39
+
20
40
  // methods
21
41
  const { passwordReset } = useAuthStore();
22
42
  const submitPasswordReset = () => {
23
43
  loading.value = true;
24
44
  message.value = null;
25
45
  errors.value = [];
26
- passwordReset(email.value)
46
+ token.value = route.params.token;
47
+ passwordReset(email.value, password.value, password_confirmation.value, token.value)
27
48
  .then((response) => {
28
- message.value = response.data.message;
49
+ message.value = response.message;
29
50
  })
30
51
  .catch((error) => {
31
- if (error.response.status === 422) {
32
- errors.value = error.response.data.errors;
52
+ if (error.response?._data?.errors) {
53
+ forIn(error.response._data.errors, function(obj, key) {
54
+ errors.value = errors.value.concat(obj);
55
+ });
33
56
  } else {
34
- errors.value = ["Error requesting password reset."];
57
+ errors.value = ["Error resetting password."];
35
58
  }
36
59
  })
37
60
  .finally(() => {
@@ -41,9 +64,12 @@ const submitPasswordReset = () => {
41
64
  </script>
42
65
 
43
66
  <template>
44
- <div :class="isCentered ? 'w-full max-w-xs mx-auto' : ''">
67
+ <div
68
+ :class="isCentered ? 'w-full max-w-xs mx-auto text-center' : ''"
69
+ class="pt-8"
70
+ >
45
71
  <div class="mb-4">
46
- Enter your email address to reset your password.
72
+ Please enter your email address and new password in order to reset your password.
47
73
  </div>
48
74
  <CommonMessage
49
75
  v-if="message"
@@ -55,20 +81,27 @@ const submitPasswordReset = () => {
55
81
  v-if="errors.length > 0"
56
82
  :success="false"
57
83
  >
58
- {{ errors[0] }}
84
+ {{ errors.join(" ") }}
59
85
  </CommonMessage>
60
- <div @keyup.enter="submitPasswordReset()">
61
- <CommonTextInput
62
- v-model="email"
63
- placeholder="Email"
64
- type="email"
65
- />
86
+ <div
87
+ v-if="!message"
88
+ @keyup.enter="submitPasswordReset()"
89
+ >
90
+ <div class="py-2">
91
+ <input type="email" id="email" placeholder="Email" class="form-input" v-model="email" required>
92
+ </div>
93
+ <div class="py-2">
94
+ <input type="password" id="password" class="form-input" placeholder="Password" v-model="password" required>
95
+ </div>
96
+ <div class="py-2">
97
+ <input type="password" id="password_confirmation" class="form-input" placeholder="Confirm Password" v-model="password_confirmation" required>
98
+ </div>
66
99
  <button
67
100
  class="btn my-2"
68
101
  @click="submitPasswordReset()"
69
102
  >
70
103
  <span v-if="loading">Processing...</span>
71
- <span v-else>Send Password Reset Link</span>
104
+ <span v-else>Update Password</span>
72
105
  </button>
73
106
  </div>
74
107
  </div>
@@ -0,0 +1,97 @@
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
+ </script>
54
+
55
+ <template>
56
+ <div
57
+ :class="isCentered ? 'w-full max-w-xs mx-auto text-center' : ''"
58
+ class="pt-8"
59
+ >
60
+ <div class="mb-4">
61
+ Enter your email address to reset your password.
62
+ </div>
63
+ <CommonMessage
64
+ v-if="message"
65
+ :success="true"
66
+ >
67
+ {{ message }}
68
+ </CommonMessage>
69
+ <CommonMessage
70
+ v-if="errors.length > 0"
71
+ :success="false"
72
+ >
73
+ {{ errors[0] }}
74
+ </CommonMessage>
75
+ <div @keyup.enter="submitPasswordResetRequest()">
76
+ <CommonTextInput
77
+ v-model="email"
78
+ placeholder="Email"
79
+ type="email"
80
+ :class="
81
+ classBinding(
82
+ classObject,
83
+ 'container',
84
+ 'form-input contrast-border mb-2'
85
+ )
86
+ "
87
+ />
88
+ <button
89
+ class="btn my-2"
90
+ @click="submitPasswordResetRequest()"
91
+ >
92
+ <span v-if="loading">Processing...</span>
93
+ <span v-else>Send Password Reset Link</span>
94
+ </button>
95
+ </div>
96
+ </div>
97
+ </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 = 'registration';
109
+ modalContent.contentType = 'login';
110
110
  modalContentEventHook.trigger(modalContent);
111
111
  };
112
112
 
@@ -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
- passwordReset(email: string): Promise<any>;
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
- passwordReset(email) {
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
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@icvdeveloper/common-module",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "exports": {