bfg-common 1.4.320 → 1.4.322
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/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePassword.vue +8 -6
- package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePasswordNew.vue +3 -7
- package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePasswordOld.vue +7 -37
- package/package.json +1 -1
package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePassword.vue
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
v-model="form"
|
|
14
14
|
:hostname="props.hostname"
|
|
15
15
|
:project="props.project"
|
|
16
|
-
@
|
|
16
|
+
@change-password="onChangePassword"
|
|
17
17
|
@hide="onHideModal"
|
|
18
18
|
/>
|
|
19
19
|
</template>
|
|
@@ -44,13 +44,13 @@ const form = ref<UI_I_ChangePasswordForm>({
|
|
|
44
44
|
confirm_password: '',
|
|
45
45
|
})
|
|
46
46
|
const onChangePassword = async (): Promise<void> => {
|
|
47
|
-
const {
|
|
47
|
+
const { current_password, new_password } = form.value
|
|
48
48
|
|
|
49
49
|
onHideModal()
|
|
50
50
|
|
|
51
51
|
const sendData: UI_I_ChangePasswordBodyRequest = {
|
|
52
|
-
current_password
|
|
53
|
-
new_password
|
|
52
|
+
current_password,
|
|
53
|
+
new_password,
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
let url = ''
|
|
@@ -69,13 +69,15 @@ const onChangePassword = async (): Promise<void> => {
|
|
|
69
69
|
})
|
|
70
70
|
|
|
71
71
|
if (error.value?.data && error.value.data.error_code !== 0) {
|
|
72
|
+
const errorText = error.value.data?.error_message || error.value.data
|
|
73
|
+
|
|
72
74
|
$store.dispatch('main/A_SHOW_NOTIFICATION', {
|
|
73
75
|
status: 'error',
|
|
74
76
|
headline: localization.value.common.operationFailed,
|
|
75
77
|
messages: [
|
|
76
78
|
{
|
|
77
|
-
title:
|
|
78
|
-
descriptions: [
|
|
79
|
+
title: localization.value.common.error,
|
|
80
|
+
descriptions: [errorText],
|
|
79
81
|
},
|
|
80
82
|
],
|
|
81
83
|
})
|
package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePasswordNew.vue
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<ui-modal
|
|
3
|
-
|
|
3
|
+
show
|
|
4
4
|
width="560px"
|
|
5
|
+
test-id="change-password-modal"
|
|
5
6
|
:title="localization.common.changePassword"
|
|
6
7
|
:subtitle="props.subtitle"
|
|
7
8
|
class="change-password"
|
|
@@ -78,7 +79,6 @@ const modelLocal = defineModel<UI_I_ChangePasswordForm>({ required: true })
|
|
|
78
79
|
|
|
79
80
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
80
81
|
|
|
81
|
-
|
|
82
82
|
const alertErrorText = ref<string>('')
|
|
83
83
|
const initValidationFields = ref<UI_I_InitialValidationFields>({
|
|
84
84
|
currentPassword: false,
|
|
@@ -142,11 +142,7 @@ const onSubmit = (): void => {
|
|
|
142
142
|
)
|
|
143
143
|
}
|
|
144
144
|
|
|
145
|
-
|
|
146
|
-
if (notReady) {
|
|
147
|
-
return
|
|
148
|
-
}
|
|
149
|
-
emits('change-password')
|
|
145
|
+
!isFieldValid && !alertErrorText.value && emits('change-password')
|
|
150
146
|
}
|
|
151
147
|
const onHideModal = (): void => {
|
|
152
148
|
emits('hide')
|
package/components/common/layout/theHeader/userMenu/modals/changePassword/ChangePasswordOld.vue
CHANGED
|
@@ -87,10 +87,9 @@
|
|
|
87
87
|
|
|
88
88
|
<script setup lang="ts">
|
|
89
89
|
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
90
|
-
import type { API_UI_I_Error } from '~/lib/models/store/interfaces'
|
|
91
90
|
import type {
|
|
92
|
-
UI_I_ChangePasswordBodyRequest,
|
|
93
91
|
UI_I_FormChangePassword,
|
|
92
|
+
UI_I_ChangePasswordForm,
|
|
94
93
|
} from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/models/interfaces'
|
|
95
94
|
import type { UI_T_Project } from '~/lib/models/types'
|
|
96
95
|
import { defaultFormFunc } from '~/components/common/layout/theHeader/userMenu/modals/changePassword/lib/config/form'
|
|
@@ -101,10 +100,12 @@ const props = defineProps<{
|
|
|
101
100
|
}>()
|
|
102
101
|
const emits = defineEmits<{
|
|
103
102
|
(event: 'hide'): void
|
|
103
|
+
(event: 'change-password'): void
|
|
104
104
|
}>()
|
|
105
|
+
const modelLocal = defineModel<UI_I_ChangePasswordForm>({ required: true })
|
|
105
106
|
|
|
106
107
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
107
|
-
const { $
|
|
108
|
+
const { $validation }: any = useNuxtApp()
|
|
108
109
|
const validation = $validation.call({})
|
|
109
110
|
|
|
110
111
|
const isValid = ref<boolean>(false)
|
|
@@ -141,40 +142,9 @@ const onChangePassword = async (): Promise<void> => {
|
|
|
141
142
|
return
|
|
142
143
|
}
|
|
143
144
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
current_password: password.value,
|
|
148
|
-
new_password: newPassword.value,
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
let url = ''
|
|
152
|
-
if (props.project === 'sphere') {
|
|
153
|
-
const { id } = useLocalStorage('userData')
|
|
154
|
-
|
|
155
|
-
url = `ui/users/${id}/passwd`
|
|
156
|
-
} else if (props.project === 'procurator') {
|
|
157
|
-
url = '/ui/passwd'
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const { error } = await useMyFetch<never, API_UI_I_Error>(url, {
|
|
161
|
-
method: 'POST',
|
|
162
|
-
body: sendData,
|
|
163
|
-
key: Date.now().toString(),
|
|
164
|
-
})
|
|
165
|
-
|
|
166
|
-
if (error.value?.data && error.value.data.error_code !== 0) {
|
|
167
|
-
$store.dispatch('main/A_SHOW_NOTIFICATION', {
|
|
168
|
-
status: 'error',
|
|
169
|
-
headline: localization.value.common.operationFailed,
|
|
170
|
-
messages: [
|
|
171
|
-
{
|
|
172
|
-
title: 'Error',
|
|
173
|
-
descriptions: [error.value.data.error_message],
|
|
174
|
-
},
|
|
175
|
-
],
|
|
176
|
-
})
|
|
177
|
-
}
|
|
145
|
+
modelLocal.value.current_password = password.value
|
|
146
|
+
modelLocal.value.new_password = newPassword.value
|
|
147
|
+
emits('change-password')
|
|
178
148
|
}
|
|
179
149
|
|
|
180
150
|
const showValidationErrors = (text: string): void => {
|