@vc-shell/framework 1.0.278 → 1.0.280

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.
Files changed (34) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/framework.js +11148 -11088
  3. package/dist/locales/en.json +3 -0
  4. package/dist/shared/components/change-password/change-password.vue.d.ts +15 -2
  5. package/dist/shared/components/change-password/change-password.vue.d.ts.map +1 -1
  6. package/dist/shared/components/change-password/index.d.ts +16 -2
  7. package/dist/shared/components/change-password/index.d.ts.map +1 -1
  8. package/dist/shared/pages/ChangePasswordPage/components/change-password/ChangePassword.vue.d.ts +16 -0
  9. package/dist/shared/pages/ChangePasswordPage/components/change-password/ChangePassword.vue.d.ts.map +1 -0
  10. package/dist/shared/pages/ChangePasswordPage/components/change-password/index.d.ts +16 -0
  11. package/dist/shared/pages/ChangePasswordPage/components/change-password/index.d.ts.map +1 -0
  12. package/dist/shared/pages/ChangePasswordPage/components/index.d.ts +2 -0
  13. package/dist/shared/pages/ChangePasswordPage/components/index.d.ts.map +1 -0
  14. package/dist/shared/pages/ChangePasswordPage/index.d.ts +2 -0
  15. package/dist/shared/pages/ChangePasswordPage/index.d.ts.map +1 -0
  16. package/dist/shared/pages/ChangePasswordPage/plugin.d.ts +4 -0
  17. package/dist/shared/pages/ChangePasswordPage/plugin.d.ts.map +1 -0
  18. package/dist/shared/pages/LoginPage/components/login/Login.vue.d.ts.map +1 -1
  19. package/dist/shared/pages/index.d.ts +1 -0
  20. package/dist/shared/pages/index.d.ts.map +1 -1
  21. package/dist/shared/pages/plugin.d.ts +1 -0
  22. package/dist/shared/pages/plugin.d.ts.map +1 -1
  23. package/dist/tsconfig.tsbuildinfo +1 -1
  24. package/package.json +4 -4
  25. package/shared/components/change-password/change-password.vue +49 -3
  26. package/shared/modules/dynamic/pages/dynamic-blade-list.vue +2 -2
  27. package/shared/pages/ChangePasswordPage/components/change-password/ChangePassword.vue +30 -0
  28. package/shared/pages/ChangePasswordPage/components/change-password/index.ts +3 -0
  29. package/shared/pages/ChangePasswordPage/components/index.ts +1 -0
  30. package/shared/pages/ChangePasswordPage/index.ts +1 -0
  31. package/shared/pages/ChangePasswordPage/plugin.ts +4 -0
  32. package/shared/pages/LoginPage/components/login/Login.vue +17 -13
  33. package/shared/pages/index.ts +1 -0
  34. package/shared/pages/plugin.ts +1 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vc-shell/framework",
3
- "version": "1.0.278",
3
+ "version": "1.0.280",
4
4
  "type": "module",
5
5
  "main": "./dist/framework.js",
6
6
  "types": "./dist/index.d.ts",
@@ -61,9 +61,9 @@
61
61
  "devDependencies": {
62
62
  "@types/dompurify": "^3.0.5",
63
63
  "@types/quill": "^2.0.14",
64
- "@vc-shell/api-client-generator": "^1.0.278",
65
- "@vc-shell/config-generator": "^1.0.278",
66
- "@vc-shell/ts-config": "^1.0.278",
64
+ "@vc-shell/api-client-generator": "^1.0.280",
65
+ "@vc-shell/config-generator": "^1.0.280",
66
+ "@vc-shell/ts-config": "^1.0.280",
67
67
  "@vitejs/plugin-vue": "^5.0.3",
68
68
  "cypress-signalr-mock": "^1.5.0",
69
69
  "sass": "^1.69.6",
@@ -2,11 +2,33 @@
2
2
  <VcPopup
3
3
  :title="t('COMPONENTS.CHANGE_PASSWORD.TITLE')"
4
4
  is-mobile-fullscreen
5
- @close="$emit('close')"
5
+ @close="cancelChange"
6
6
  >
7
7
  <template #content>
8
8
  <!-- <div class="change-password tw-p-3 tw-overflow-scroll"> -->
9
9
  <VcForm class="tw-flex tw-flex-col tw-flex-auto">
10
+ <div
11
+ v-if="forced"
12
+ class="tw-mb-4"
13
+ >
14
+ <vc-status
15
+ extend
16
+ :outline="false"
17
+ variant="info-dark"
18
+ >
19
+ <div class="tw-flex tw-flex-row tw-items-center">
20
+ <VcIcon
21
+ icon="far fa-lightbulb"
22
+ size="l"
23
+ class="tw-mr-3"
24
+ />
25
+ <div>
26
+ <p>{{ t("COMPONENTS.CHANGE_PASSWORD.FORCED.LABEL") }}</p>
27
+ </div>
28
+ </div>
29
+ </vc-status>
30
+ </div>
31
+
10
32
  <Field
11
33
  v-slot="{ field, errorMessage, errors }"
12
34
  :label="t('COMPONENTS.CHANGE_PASSWORD.CURRENT_PASSWORD.LABEL')"
@@ -82,7 +104,7 @@
82
104
  <VcButton
83
105
  :outline="true"
84
106
  class="tw-mr-3"
85
- @click="$emit('close')"
107
+ @click="cancelChange"
86
108
  >
87
109
  {{ t("COMPONENTS.CHANGE_PASSWORD.CANCEL") }}
88
110
  </VcButton>
@@ -117,6 +139,7 @@ import { VcInput, VcHint, VcButton, VcPopup, VcForm } from "./../../../ui/compon
117
139
  import { IIdentityError } from "./../../../core/api/platform";
118
140
  import { useUser } from "./../../../core/composables/useUser";
119
141
  import { useI18n } from "vue-i18n";
142
+ import { useRouter } from "vue-router";
120
143
 
121
144
  interface IChangePassForm {
122
145
  isValid: boolean;
@@ -126,6 +149,13 @@ interface IChangePassForm {
126
149
  confirmPassword: string;
127
150
  }
128
151
 
152
+ export interface Props {
153
+ forced?: boolean;
154
+ login?: string;
155
+ }
156
+
157
+ const props = defineProps<Props>();
158
+
129
159
  interface Emits {
130
160
  (event: "close"): void;
131
161
  }
@@ -136,6 +166,9 @@ const { changeUserPassword, loading, validatePassword } = useUser();
136
166
  useForm({ validateOnMount: false });
137
167
  const isValid = useIsFormValid();
138
168
  const isDirty = useIsFormDirty();
169
+ const router = useRouter();
170
+ const { signOut } = useUser();
171
+
139
172
  const form = reactive<IChangePassForm>({
140
173
  isValid: false,
141
174
  errors: [],
@@ -148,10 +181,23 @@ const isDisabled = computed(() => {
148
181
  return !isDirty.value || !isValid.value;
149
182
  });
150
183
 
184
+ async function cancelChange() {
185
+ if (props.forced) {
186
+ await signOut();
187
+ await router.push("/login");
188
+ } else {
189
+ emit("close");
190
+ }
191
+ }
192
+
151
193
  async function changePassword() {
152
194
  const result = await changeUserPassword(form.currentPassword, form.password);
153
195
  if (result?.succeeded) {
154
- emit("close");
196
+ if (props.forced) {
197
+ await router.push("/");
198
+ } else {
199
+ emit("close");
200
+ }
155
201
  } else if (result?.errors) {
156
202
  form.errors = result?.errors;
157
203
  form.isValid = form.errors.length == 0;
@@ -291,13 +291,13 @@ const { load, remove, items, loading, pagination, query, scope } = props.composa
291
291
  } as unknown as UseList<Record<string, any>[], Record<string, any>, ListBaseBladeScope>);
292
292
 
293
293
  const isBladeEditable = computed(() =>
294
- "disabled" in toValue(scope || {}) ? !toValue(toValue(scope || {}).disabled) : false,
294
+ "disabled" in toValue(scope || {}) ? !toValue(toValue(scope || {})?.disabled) : false,
295
295
  );
296
296
 
297
297
  const selection = computed(
298
298
  () =>
299
299
  ("selectedIds" in toValue(scope || {}) &&
300
- items.value?.filter((item) => toValue(toValue(scope || {}).selectedIds)?.includes(item.id))) ||
300
+ items.value?.filter((item) => toValue(toValue(scope || {})?.selectedIds)?.includes(item.id))) ||
301
301
  [],
302
302
  );
303
303
 
@@ -0,0 +1,30 @@
1
+ <template>
2
+ <div
3
+ class="tw-w-full tw-h-full tw-box-border tw-flex tw-flex-col tw-items-center tw-justify-center"
4
+ :style="backgroundImageHandler"
5
+ >
6
+ <ChangePassword :forced="forced"> </ChangePassword>
7
+ </div>
8
+ </template>
9
+
10
+ <script lang="ts" setup>
11
+ import { computed } from "vue";
12
+ import { useRouter } from "vue-router";
13
+
14
+ const router = useRouter();
15
+
16
+ const forced = router.currentRoute.value.meta?.forced;
17
+
18
+ import { ChangePassword } from "../../../../components/change-password";
19
+
20
+ export interface Props {
21
+ background?: string;
22
+ userName?: string;
23
+ }
24
+
25
+ const props = defineProps<Props>();
26
+
27
+ const backgroundImageHandler = computed(() => {
28
+ return `background: url('/assets/background.jpg') center / cover no-repeat`;
29
+ });
30
+ </script>
@@ -0,0 +1,3 @@
1
+ import _ChangePassword from "./ChangePassword.vue";
2
+
3
+ export const ChangePasswordPage = _ChangePassword as typeof _ChangePassword;
@@ -0,0 +1 @@
1
+ export * from "./change-password";
@@ -0,0 +1 @@
1
+ export * from "./components";
@@ -0,0 +1,4 @@
1
+ import { createModule } from "./../../../core/plugins";
2
+ import * as components from "./components";
3
+
4
+ export const ChangePasswordPage = createModule(components);
@@ -204,7 +204,7 @@ let useLogin;
204
204
  const signInResult = ref({ succeeded: true }) as Ref<SignInResult & { status?: number; error?: any }>;
205
205
  const requestPassResult = ref<RequestPasswordResult>({ succeeded: true });
206
206
  const forgotPasswordRequestSent = ref(false);
207
- const { signIn, loading, externalSignIn, getExternalLoginProviders } = useUser();
207
+ const { signIn, loading, externalSignIn, getExternalLoginProviders, user } = useUser();
208
208
  const isLogin = ref(true);
209
209
  const isValid = useIsFormValid();
210
210
  const isDirty = useIsFormDirty();
@@ -258,21 +258,25 @@ const login = async () => {
258
258
  error?: any;
259
259
  };
260
260
 
261
- if (signInResult.value.succeeded) {
262
- const redirectTo = localStorage.getItem("redirectAfterLogin") || "/";
263
- localStorage.removeItem("redirectAfterLogin");
264
- await router.push(redirectTo);
261
+ if (signInResult.value.succeeded && user.value?.passwordExpired) {
262
+ await router.push({ name: "ChangePassword" });
265
263
  } else {
266
- if (signInResult.value.status) {
267
- if (signInResult.value.status === 401) {
268
- signInResult.value.error = "The login or password is incorrect.";
269
- form.password = "";
270
- validateField("password");
264
+ if (signInResult.value.succeeded) {
265
+ const redirectTo = localStorage.getItem("redirectAfterLogin") || "/";
266
+ localStorage.removeItem("redirectAfterLogin");
267
+ await router.push(redirectTo);
268
+ } else {
269
+ if (signInResult.value.status) {
270
+ if (signInResult.value.status === 401) {
271
+ signInResult.value.error = "The login or password is incorrect.";
272
+ form.password = "";
273
+ validateField("password");
274
+ } else {
275
+ signInResult.value.error = "Authentication error (code: " + signInResult.value.status + ").";
276
+ }
271
277
  } else {
272
- signInResult.value.error = "Authentication error (code: " + signInResult.value.status + ").";
278
+ signInResult.value.error = "Authentication error: " + signInResult.value.error;
273
279
  }
274
- } else {
275
- signInResult.value.error = "Authentication error: " + signInResult.value.error;
276
280
  }
277
281
  }
278
282
  }
@@ -1,3 +1,4 @@
1
1
  export * from "./InvitePage";
2
2
  export * from "./LoginPage";
3
3
  export * from "./ResetPasswordPage";
4
+ export * from "./ChangePasswordPage";
@@ -1,3 +1,4 @@
1
1
  export * from "./InvitePage/plugin";
2
2
  export * from "./LoginPage/plugin";
3
3
  export * from "./ResetPasswordPage/plugin";
4
+ export * from "./ChangePasswordPage/plugin";