bfg-common 1.4.314 → 1.4.316

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.
@@ -5,11 +5,12 @@
5
5
  :subtitle="props.hostname"
6
6
  :project="props.project"
7
7
  @hide="onHideModal"
8
- @apply="onChangePassword"
8
+ @change-password="onChangePassword"
9
9
  />
10
10
 
11
11
  <common-layout-the-header-user-menu-modals-change-password-old
12
12
  v-else
13
+ v-model="form"
13
14
  :hostname="props.hostname"
14
15
  :project="props.project"
15
16
  @hide="onHideModal"
@@ -25,7 +26,6 @@ import type {
25
26
  UI_I_FormChangePassword,
26
27
  } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/models/interfaces'
27
28
  import type { UI_T_Project } from '~/lib/models/types'
28
- import { defaultFormFunc } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/config/form'
29
29
 
30
30
  const props = defineProps<{
31
31
  newView: boolean
@@ -35,39 +35,21 @@ const props = defineProps<{
35
35
  const isShowModalLocal = defineModel<boolean>({ required: true })
36
36
 
37
37
  const localization = computed<UI_I_Localization>(() => useLocal())
38
- const { $store, $validation }: any = useNuxtApp()
39
- const validation = $validation.call({})
40
-
41
- const isValid = ref<boolean>(false)
42
- const errorText = ref<string>('')
43
- const form = ref<UI_I_FormChangePassword>(
44
- useDeepCopy(defaultFormFunc(localization.value))
45
- )
46
-
47
- const setForm = (): void => {
48
- form.value = useDeepCopy(defaultFormFunc(localization.value))
49
- validation.setForm(form)
50
- }
51
- setForm()
38
+ const { $store }: any = useNuxtApp()
52
39
 
40
+ const form = ref<UI_I_FormChangePassword>({
41
+ password: '',
42
+ new_password: '',
43
+ confirm_password: '',
44
+ })
53
45
  const onChangePassword = async (): Promise<void> => {
54
- const valid = validation.touch()
55
- const { newPassword, password } = form.value
56
-
57
- if (newPassword.value === password.value) {
58
- showValidationErrors(localization.value.common.newPasswordMustDifferentOld)
59
- return
60
- }
61
- if (!valid.isValid) {
62
- showValidationErrors(valid.errors.confirmPassword[0])
63
- return
64
- }
46
+ const { new_password, password } = form.value
65
47
 
66
48
  onHideModal()
67
49
 
68
50
  const sendData: UI_I_ChangePasswordBodyRequest = {
69
- current_password: password.value,
70
- new_password: newPassword.value,
51
+ current_password: password,
52
+ new_password: new_password,
71
53
  }
72
54
 
73
55
  let url = ''
@@ -98,15 +80,7 @@ const onChangePassword = async (): Promise<void> => {
98
80
  })
99
81
  }
100
82
  }
101
-
102
- const showValidationErrors = (text: string): void => {
103
- isValid.value = true
104
- errorText.value = text
105
- }
106
-
107
83
  const onHideModal = (): void => {
108
84
  isShowModalLocal.value = false
109
- setForm()
110
- isValid.value = false
111
85
  }
112
86
  </script>
@@ -28,7 +28,7 @@
28
28
  v-model="modelLocal.current_password"
29
29
  test-id="change-password-password-field"
30
30
  :label="localization.auth.password"
31
- :error="errorText"
31
+ :error="passwordErrorText"
32
32
  type="password"
33
33
  ></ui-input>
34
34
 
@@ -36,7 +36,7 @@
36
36
  v-model="modelLocal.new_password"
37
37
  test-id="change-password-new-password-field"
38
38
  :label="localization.common.newPassword"
39
- :error="errorText"
39
+ :error="newPasswordErrorText"
40
40
  type="password"
41
41
  ></ui-input>
42
42
 
@@ -44,7 +44,7 @@
44
44
  v-model="modelLocal.confirm_password"
45
45
  test-id="change-password-confirm-password-field"
46
46
  :label="localization.common.confirmPassword"
47
- :error="errorText"
47
+ :error="confirmPasswordErrorText"
48
48
  type="password"
49
49
  ></ui-input>
50
50
  </div>
@@ -66,7 +66,7 @@ const props = defineProps<{
66
66
  }>()
67
67
  const emits = defineEmits<{
68
68
  (event: 'hide'): void
69
- (event: 'submit'): void
69
+ (event: 'change-password'): void
70
70
  }>()
71
71
  const modelLocal = defineModel<UI_I_FormChangePassword>({ required: true })
72
72
 
@@ -75,6 +75,16 @@ const localization = computed<UI_I_Localization>(() => useLocal())
75
75
  // const isValid = ref<boolean>(false)
76
76
  const errorText = ref<string>('')
77
77
 
78
+ const passwordErrorText = computed<string>(() => {
79
+ return ''
80
+ })
81
+ const newPasswordErrorText = computed<string>(() => {
82
+ return ''
83
+ })
84
+ const confirmPasswordErrorText = computed<string>(() => {
85
+ return ''
86
+ })
87
+
78
88
  // const showValidationErrors = (text: string): void => {
79
89
  // isValid.value = true
80
90
  // errorText.value = text
@@ -89,6 +99,12 @@ const errorText = ref<string>('')
89
99
  const onSubmit = (): void => {
90
100
  // const { } = modelLocal.value
91
101
  errorText.value = 'asdaldjlkdjkadj'
102
+
103
+ const notReady = true
104
+ if (notReady) {
105
+ return
106
+ }
107
+ emits('change-password')
92
108
  }
93
109
  </script>
94
110
 
@@ -103,7 +119,12 @@ const onSubmit = (): void => {
103
119
  margin-bottom: 20px;
104
120
  }
105
121
  &__alert {
122
+ padding: 10px 12px;
106
123
  margin-bottom: 12px;
124
+ :deep(svg) {
125
+ width: 16px;
126
+ height: 16px;
127
+ }
107
128
  }
108
129
  &__form {
109
130
  @include flex($dir: column);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "bfg-common",
3
3
  "private": false,
4
- "version": "1.4.314",
4
+ "version": "1.4.316",
5
5
  "scripts": {
6
6
  "build": "nuxt build",
7
7
  "dev": "nuxt dev --port=3002",