bfg-common 1.5.688 → 1.5.690
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/assets/localization/local_be.json +3804 -3783
- package/assets/localization/local_en.json +3808 -3787
- package/assets/localization/local_hy.json +21 -0
- package/assets/localization/local_kk.json +21 -0
- package/assets/localization/local_ru.json +21 -0
- package/assets/localization/local_zh.json +21 -0
- package/assets/scss/components/auth.scss +15 -5
- package/components/atoms/dropdown/tree/Tree.vue +2 -0
- package/components/atoms/switch/Switch.vue +7 -1
- package/components/atoms/wizard/Wizard.vue +1 -1
- package/components/common/layout/theHeader/userMenu/modals/preferences/PreferencesNew.vue +115 -115
- package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/ChangeLanguage.vue +108 -108
- package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/New.vue +88 -88
- package/components/common/layout/theHeader/userMenu/modals/preferences/changeLanguage/Old.vue +89 -89
- package/components/common/layout/theHeader/userMenu/modals/preferences/defaultConsole/DefaultConsole.vue +43 -43
- package/components/common/layout/theHeader/userMenu/modals/preferences/defaultConsole/New.vue +53 -53
- package/components/common/layout/theHeader/userMenu/modals/preferences/defaultConsole/Old.vue +49 -49
- package/components/common/layout/theHeader/userMenu/modals/preferences/inventory/Inventory.vue +31 -31
- package/components/common/layout/theHeader/userMenu/modals/preferences/inventory/New.vue +36 -36
- package/components/common/layout/theHeader/userMenu/modals/preferences/inventory/Old.vue +31 -31
- package/components/common/layout/theHeader/userMenu/modals/preferences/security/New.vue +282 -34
- package/components/common/layout/theHeader/userMenu/modals/preferences/security/Old.vue +23 -55
- package/components/common/layout/theHeader/userMenu/modals/preferences/security/Security.vue +65 -6
- package/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/New.vue +52 -52
- package/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/Old.vue +45 -45
- package/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/TimeFormat.vue +54 -54
- package/components/common/layout/theHeader/userMenu/modals/preferences/view/New.vue +47 -47
- package/components/common/layout/theHeader/userMenu/modals/preferences/view/Old.vue +112 -112
- package/components/common/layout/theHeader/userMenu/modals/preferences/view/View.vue +46 -46
- package/components/common/qr/Qr.vue +17 -5
- package/components/common/vm/actions/clone/old/Old.vue +1 -0
- package/components/common/wizards/common/compatibility/New.vue +1 -1
- package/components/common/wizards/common/compatibility/Old.vue +1 -1
- package/lib/models/interfaces.ts +1 -0
- package/package.json +1 -1
|
@@ -1,34 +1,282 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
<
|
|
5
|
-
<ui-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
<div>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
<
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
1
|
+
<template>
|
|
2
|
+
<!-- TODO Shorten code by the new component for the form -->
|
|
3
|
+
<div class="flex">
|
|
4
|
+
<ui-modal-icon>
|
|
5
|
+
<ui-icon name="security" width="20" height="20" />
|
|
6
|
+
</ui-modal-icon>
|
|
7
|
+
<div>
|
|
8
|
+
<div class="form-first-title">
|
|
9
|
+
{{ localization.common.security }}
|
|
10
|
+
</div>
|
|
11
|
+
<div class="form-second-title">
|
|
12
|
+
{{ localization.myPreferences.twoFactorAuthentication2 }}
|
|
13
|
+
</div>
|
|
14
|
+
|
|
15
|
+
<div class="flex-align-center new-view-switch-container">
|
|
16
|
+
<ui-switch
|
|
17
|
+
v-model="security"
|
|
18
|
+
:label="localization.myPreferences.securityLabel"
|
|
19
|
+
test-id="view-switch"
|
|
20
|
+
/>
|
|
21
|
+
</div>
|
|
22
|
+
<div
|
|
23
|
+
v-if="
|
|
24
|
+
props.recovery &&
|
|
25
|
+
security &&
|
|
26
|
+
!props.initialSecurity &&
|
|
27
|
+
!props.otpEnabledSuccess
|
|
28
|
+
"
|
|
29
|
+
class="recovery-codes-wrap mt-4"
|
|
30
|
+
>
|
|
31
|
+
<p class="description-block mb-3">
|
|
32
|
+
{{ localization.myPreferences.enterOtpForEnabled }}
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
<div class="recovery-codes flex items-center p-3 mb-4">
|
|
36
|
+
<common-qr
|
|
37
|
+
:qr-code-url="props.recovery.qr_code_url"
|
|
38
|
+
width="112"
|
|
39
|
+
height="112"
|
|
40
|
+
/>
|
|
41
|
+
|
|
42
|
+
<span class="or-text">{{ localization.common.or }}</span>
|
|
43
|
+
|
|
44
|
+
<div class="flex items-center p-3">
|
|
45
|
+
<ul class="recovery-codes-list">
|
|
46
|
+
<li
|
|
47
|
+
v-for="item in props.recovery.recovery_codes"
|
|
48
|
+
:key="item"
|
|
49
|
+
class="recovery-codes-list-item code-text"
|
|
50
|
+
>
|
|
51
|
+
{{ item }}
|
|
52
|
+
</li>
|
|
53
|
+
</ul>
|
|
54
|
+
<ui-icon
|
|
55
|
+
name="copy"
|
|
56
|
+
class="copy-icon"
|
|
57
|
+
width="16"
|
|
58
|
+
height="16"
|
|
59
|
+
@click="onCopyCode"
|
|
60
|
+
/>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
<section class="form-block">
|
|
64
|
+
<div class="form-group flex items-center flex-wrap">
|
|
65
|
+
<label for="otp" class="mr-3">{{
|
|
66
|
+
localization.myPreferences.enterOtpCode
|
|
67
|
+
}}</label>
|
|
68
|
+
<div class="input-block-container mr-2">
|
|
69
|
+
<ui-input
|
|
70
|
+
id="otp"
|
|
71
|
+
v-model="otp"
|
|
72
|
+
:placeholder="localization.myPreferences.otpCode"
|
|
73
|
+
:error="errorOtpInput"
|
|
74
|
+
test-id="otp"
|
|
75
|
+
size="sm"
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
<ui-button
|
|
79
|
+
:is-loading="props.isOtpLoading"
|
|
80
|
+
test-id="confirm-otp-code"
|
|
81
|
+
class="btn btn-sm btn-primary"
|
|
82
|
+
@click="onConfirm"
|
|
83
|
+
>
|
|
84
|
+
{{ localization.common.confirm }}
|
|
85
|
+
</ui-button>
|
|
86
|
+
</div>
|
|
87
|
+
</section>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<div
|
|
91
|
+
v-if="!security && props.initialSecurity && !props.otpDisabledSuccess"
|
|
92
|
+
class="turning-off-block"
|
|
93
|
+
>
|
|
94
|
+
<section class="form-block">
|
|
95
|
+
<div class="form-group flex items-center flex-wrap">
|
|
96
|
+
<label for="otp" class="mb-3">{{
|
|
97
|
+
localization.myPreferences.enterOtpForDisabled
|
|
98
|
+
}}</label>
|
|
99
|
+
<div class="input-block-container mr-2">
|
|
100
|
+
<ui-input
|
|
101
|
+
id="otp"
|
|
102
|
+
v-model="otp"
|
|
103
|
+
:placeholder="localization.myPreferences.otpCode"
|
|
104
|
+
:error="errorDisabledOtpInput"
|
|
105
|
+
test-id="otp"
|
|
106
|
+
size="sm"
|
|
107
|
+
/>
|
|
108
|
+
</div>
|
|
109
|
+
<ui-button
|
|
110
|
+
:is-loading="props.isOtpLoading"
|
|
111
|
+
test-id="disabled-otp-code"
|
|
112
|
+
class="btn btn-sm btn-primary"
|
|
113
|
+
@click="onDisabled"
|
|
114
|
+
>
|
|
115
|
+
{{ localization.common.confirm }}
|
|
116
|
+
</ui-button>
|
|
117
|
+
</div>
|
|
118
|
+
</section>
|
|
119
|
+
</div>
|
|
120
|
+
</div>
|
|
121
|
+
</div>
|
|
122
|
+
</template>
|
|
123
|
+
|
|
124
|
+
<script setup lang="ts">
|
|
125
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
126
|
+
import type { UI_I_Recovery } from '~/components/common/layout/theHeader/userMenu/modals/preferences/security/lib/models/interfaces'
|
|
127
|
+
|
|
128
|
+
const security = defineModel<boolean>('security')
|
|
129
|
+
const otp = defineModel<string>('otp')
|
|
130
|
+
|
|
131
|
+
const props = defineProps<{
|
|
132
|
+
initialSecurity: boolean
|
|
133
|
+
isOtpLoading: boolean
|
|
134
|
+
otpEnabledSuccess: boolean
|
|
135
|
+
otpDisabledSuccess: boolean
|
|
136
|
+
otpErrorApiText: string
|
|
137
|
+
otpDisabledErrorApiText: string
|
|
138
|
+
recovery: UI_I_Recovery
|
|
139
|
+
}>()
|
|
140
|
+
|
|
141
|
+
const emits = defineEmits<{
|
|
142
|
+
(event: 'confirm'): void
|
|
143
|
+
(event: 'disabled'): void
|
|
144
|
+
}>()
|
|
145
|
+
|
|
146
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
147
|
+
|
|
148
|
+
const onCopyCode = (): void => {
|
|
149
|
+
const currentCopiedCode = props.recovery.recovery_codes[0] || ''
|
|
150
|
+
navigator.clipboard.writeText(currentCopiedCode)
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const errorOtpInput = ref<string>('')
|
|
154
|
+
const onConfirm = (): void => {
|
|
155
|
+
if (!otp.value) {
|
|
156
|
+
errorOtpInput.value = localization.value.common.fieldRequired
|
|
157
|
+
} else if (otp.value.length < 6) {
|
|
158
|
+
errorOtpInput.value = localization.value.myPreferences.otpCodeErrorLength
|
|
159
|
+
} else {
|
|
160
|
+
errorOtpInput.value = ''
|
|
161
|
+
emits('confirm')
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const errorDisabledOtpInput = ref<string>('')
|
|
166
|
+
const onDisabled = (): void => {
|
|
167
|
+
if (!otp.value) {
|
|
168
|
+
errorDisabledOtpInput.value = localization.value.common.fieldRequired
|
|
169
|
+
} else if (otp.value.length < 6) {
|
|
170
|
+
errorDisabledOtpInput.value =
|
|
171
|
+
localization.value.myPreferences.otpCodeErrorLength
|
|
172
|
+
} else {
|
|
173
|
+
errorDisabledOtpInput.value = ''
|
|
174
|
+
emits('disabled')
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
watch(
|
|
179
|
+
() => props.otpErrorApiText,
|
|
180
|
+
(newValue) => {
|
|
181
|
+
if (newValue) {
|
|
182
|
+
errorOtpInput.value = newValue
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
)
|
|
186
|
+
|
|
187
|
+
watch(
|
|
188
|
+
() => props.otpDisabledErrorApiText,
|
|
189
|
+
(newValue) => {
|
|
190
|
+
if (newValue) {
|
|
191
|
+
errorDisabledOtpInput.value = newValue
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
)
|
|
195
|
+
</script>
|
|
196
|
+
|
|
197
|
+
<style>
|
|
198
|
+
:root {
|
|
199
|
+
--security-block-qr-bg-color: #ffffff;
|
|
200
|
+
--security-block-qr-border-color: #e9ebed;
|
|
201
|
+
--security-block-qr-or-text: #4d5d69;
|
|
202
|
+
--security-block-qr-code-text: #4d5d69;
|
|
203
|
+
--security-block-qr-first-rect: #ffffff;
|
|
204
|
+
--security-block-qr-path: #1b2a37;
|
|
205
|
+
--security-block-form-block-label: #4d5d69;
|
|
206
|
+
}
|
|
207
|
+
:root.dark-theme {
|
|
208
|
+
--security-block-qr-bg-color: #1b2a371f;
|
|
209
|
+
--security-block-qr-border-color: #e9ebed1f;
|
|
210
|
+
--security-block-qr-or-text: #9da6ad;
|
|
211
|
+
--security-block-qr-code-text: #e9eaec;
|
|
212
|
+
--security-block-qr-first-rect: rgba(255, 255, 255, 0);
|
|
213
|
+
--security-block-qr-path: #e9eaec;
|
|
214
|
+
--security-block-form-block-label: #9da6ad;
|
|
215
|
+
}
|
|
216
|
+
</style>
|
|
217
|
+
<style>
|
|
218
|
+
.recovery-codes-wrap {
|
|
219
|
+
.description-block {
|
|
220
|
+
font-size: 13px;
|
|
221
|
+
font-weight: 400;
|
|
222
|
+
color: #9da6ad;
|
|
223
|
+
line-height: 18px;
|
|
224
|
+
}
|
|
225
|
+
.recovery-codes {
|
|
226
|
+
justify-content: space-around;
|
|
227
|
+
border: 1px solid var(--security-block-qr-border-color);
|
|
228
|
+
background-color: var(--security-block-qr-bg-color);
|
|
229
|
+
border-radius: 8px;
|
|
230
|
+
grid-column-gap: 12px;
|
|
231
|
+
|
|
232
|
+
.qrcode {
|
|
233
|
+
padding: 8px;
|
|
234
|
+
|
|
235
|
+
rect:first-child {
|
|
236
|
+
fill: var(--security-block-qr-first-rect);
|
|
237
|
+
}
|
|
238
|
+
path {
|
|
239
|
+
fill: var(--security-block-qr-path);
|
|
240
|
+
}
|
|
241
|
+
rect:not(:first-child) {
|
|
242
|
+
fill: var(--security-block-qr-path);
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
.or-text {
|
|
246
|
+
color: var(--security-block-qr-or-text);
|
|
247
|
+
}
|
|
248
|
+
.code-text {
|
|
249
|
+
color: var(--security-block-qr-code-text);
|
|
250
|
+
}
|
|
251
|
+
.copy-icon {
|
|
252
|
+
color: #008fd6;
|
|
253
|
+
cursor: pointer;
|
|
254
|
+
margin-left: 10px;
|
|
255
|
+
|
|
256
|
+
&:hover {
|
|
257
|
+
color: #0081c1;
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
.form-group {
|
|
262
|
+
label {
|
|
263
|
+
color: var(--security-block-form-block-label) !important;
|
|
264
|
+
}
|
|
265
|
+
.input-block-container {
|
|
266
|
+
width: 160px;
|
|
267
|
+
height: 32px;
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
.turning-off-block {
|
|
272
|
+
.form-group {
|
|
273
|
+
label {
|
|
274
|
+
color: var(--security-block-form-block-label) !important;
|
|
275
|
+
}
|
|
276
|
+
.input-block-container {
|
|
277
|
+
width: 160px;
|
|
278
|
+
height: 32px;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
</style>
|
|
@@ -13,7 +13,10 @@
|
|
|
13
13
|
|
|
14
14
|
<div
|
|
15
15
|
v-if="
|
|
16
|
-
props.recovery &&
|
|
16
|
+
props.recovery &&
|
|
17
|
+
security &&
|
|
18
|
+
!props.initialSecurity &&
|
|
19
|
+
!props.otpEnabledSuccess
|
|
17
20
|
"
|
|
18
21
|
class="recovery-codes-wrap"
|
|
19
22
|
>
|
|
@@ -42,25 +45,31 @@
|
|
|
42
45
|
localization.myPreferences.enterOtpForEnabled
|
|
43
46
|
}}</label>
|
|
44
47
|
<input id="otp" v-model="otp" type="text" />
|
|
45
|
-
<button class="btn btn-sm btn-primary" @click="
|
|
48
|
+
<button class="btn btn-sm btn-primary" @click="emits('confirm')">
|
|
46
49
|
{{ localization.common.confirm }}
|
|
47
50
|
</button>
|
|
48
|
-
<atoms-loader
|
|
51
|
+
<atoms-loader
|
|
52
|
+
v-if="props.isOtpLoading"
|
|
53
|
+
test-id="2fa-enabled-loader"
|
|
54
|
+
/>
|
|
49
55
|
</div>
|
|
50
56
|
</section>
|
|
51
57
|
</div>
|
|
52
58
|
|
|
53
|
-
<div v-if="!security && initialSecurity && !otpDisabledSuccess">
|
|
59
|
+
<div v-if="!security && props.initialSecurity && !props.otpDisabledSuccess">
|
|
54
60
|
<section class="form-block">
|
|
55
61
|
<div class="form-group">
|
|
56
62
|
<label for="otp">{{
|
|
57
63
|
localization.myPreferences.enterOtpForDisabled
|
|
58
64
|
}}</label>
|
|
59
65
|
<input id="otp" v-model="otp" type="text" />
|
|
60
|
-
<button class="btn btn-sm btn-primary" @click="
|
|
66
|
+
<button class="btn btn-sm btn-primary" @click="emits('disabled')">
|
|
61
67
|
{{ localization.common.confirm }}
|
|
62
68
|
</button>
|
|
63
|
-
<atoms-loader
|
|
69
|
+
<atoms-loader
|
|
70
|
+
v-if="props.isOtpLoading"
|
|
71
|
+
test-id="2fa-disabled-loader"
|
|
72
|
+
/>
|
|
64
73
|
</div>
|
|
65
74
|
</section>
|
|
66
75
|
</div>
|
|
@@ -72,62 +81,21 @@ import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
|
72
81
|
import type { UI_I_Recovery } from '~/components/common/layout/theHeader/userMenu/modals/preferences/security/lib/models/interfaces'
|
|
73
82
|
|
|
74
83
|
const security = defineModel<boolean>('security')
|
|
84
|
+
const otp = defineModel<string>('otp')
|
|
75
85
|
|
|
76
86
|
const props = defineProps<{
|
|
77
|
-
|
|
87
|
+
initialSecurity: boolean
|
|
88
|
+
isOtpLoading: boolean
|
|
89
|
+
otpEnabledSuccess: boolean
|
|
90
|
+
otpDisabledSuccess: boolean
|
|
91
|
+
recovery: UI_I_Recovery
|
|
78
92
|
}>()
|
|
79
93
|
const emits = defineEmits<{
|
|
80
|
-
(event: 'confirm'
|
|
94
|
+
(event: 'confirm'): void
|
|
95
|
+
(event: 'disabled'): void
|
|
81
96
|
}>()
|
|
82
97
|
|
|
83
98
|
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
84
|
-
|
|
85
|
-
const initialSecurity = ref<boolean>(security.value || false)
|
|
86
|
-
|
|
87
|
-
// TODO refactoring and move to Sphere
|
|
88
|
-
const otp = ref<string>('')
|
|
89
|
-
const isOtpLoading = ref<boolean>(false)
|
|
90
|
-
|
|
91
|
-
const otpEnabledSuccess = ref<boolean>(false)
|
|
92
|
-
const onConfirm = async (): Promise<void> => {
|
|
93
|
-
isOtpLoading.value = true
|
|
94
|
-
const { data } = await useMyFetch<any, any>('ui/auth/2fa/confirm', {
|
|
95
|
-
method: 'POST',
|
|
96
|
-
body: {
|
|
97
|
-
otp: otp.value,
|
|
98
|
-
},
|
|
99
|
-
})
|
|
100
|
-
if (data.value) {
|
|
101
|
-
otpEnabledSuccess.value = true
|
|
102
|
-
otpDisabledSuccess.value = false
|
|
103
|
-
initialSecurity.value = true
|
|
104
|
-
otp.value = ''
|
|
105
|
-
emits('confirm', true)
|
|
106
|
-
}
|
|
107
|
-
isOtpLoading.value = false
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
const otpDisabledSuccess = ref<boolean>(false)
|
|
111
|
-
const onDisabled = async (): Promise<void> => {
|
|
112
|
-
isOtpLoading.value = true
|
|
113
|
-
const { data } = await useMyFetch<any, I_ErrorResponse>(
|
|
114
|
-
'ui/auth/2fa/disable',
|
|
115
|
-
{
|
|
116
|
-
method: 'POST',
|
|
117
|
-
body: {
|
|
118
|
-
otp: otp.value,
|
|
119
|
-
},
|
|
120
|
-
}
|
|
121
|
-
)
|
|
122
|
-
if (data.value) {
|
|
123
|
-
otpDisabledSuccess.value = true
|
|
124
|
-
otpEnabledSuccess.value = false
|
|
125
|
-
initialSecurity.value = false
|
|
126
|
-
otp.value = ''
|
|
127
|
-
emits('confirm', false)
|
|
128
|
-
}
|
|
129
|
-
isOtpLoading.value = false
|
|
130
|
-
}
|
|
131
99
|
</script>
|
|
132
100
|
|
|
133
101
|
<style lang="scss" scoped>
|
package/components/common/layout/theHeader/userMenu/modals/preferences/security/Security.vue
CHANGED
|
@@ -1,26 +1,33 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<component
|
|
3
3
|
v-model:security="security"
|
|
4
|
+
v-model:otp="otp"
|
|
4
5
|
:is="currentComponent"
|
|
6
|
+
:initial-security="initialSecurity"
|
|
7
|
+
:is-otp-loading="isOtpLoading"
|
|
8
|
+
:otp-enabled-success="otpEnabledSuccess"
|
|
9
|
+
:otp-disabled-success="otpDisabledSuccess"
|
|
5
10
|
:recovery="props.recovery"
|
|
6
|
-
|
|
11
|
+
:otp-error-api-text="otpErrorApiText"
|
|
12
|
+
:otp-disabled-error-api-text="otpDisabledErrorApiText"
|
|
13
|
+
@confirm="onConfirm"
|
|
14
|
+
@disabled="onDisabled"
|
|
7
15
|
/>
|
|
8
16
|
</template>
|
|
9
17
|
|
|
10
18
|
<script setup lang="ts">
|
|
11
|
-
import type {
|
|
12
|
-
|
|
13
|
-
|
|
19
|
+
import type { UI_I_Recovery } from '~/components/common/layout/theHeader/userMenu/modals/preferences/security/lib/models/interfaces'
|
|
20
|
+
|
|
21
|
+
const security = defineModel<boolean>('security')
|
|
14
22
|
|
|
15
23
|
const props = defineProps<{
|
|
16
24
|
recovery: UI_I_Recovery | null
|
|
17
25
|
}>()
|
|
26
|
+
|
|
18
27
|
const emits = defineEmits<{
|
|
19
28
|
(event: 'confirm', value: boolean): void
|
|
20
29
|
}>()
|
|
21
30
|
|
|
22
|
-
const security = defineModel<boolean>('security')
|
|
23
|
-
|
|
24
31
|
const { $store }: any = useNuxtApp()
|
|
25
32
|
const isNewView = computed<boolean>(() => $store.getters['main/getIsNewView'])
|
|
26
33
|
const currentComponent = computed(() =>
|
|
@@ -28,4 +35,56 @@ const currentComponent = computed(() =>
|
|
|
28
35
|
? defineAsyncComponent(() => import('./New.vue'))
|
|
29
36
|
: defineAsyncComponent(() => import('./Old.vue'))
|
|
30
37
|
)
|
|
38
|
+
|
|
39
|
+
const initialSecurity = ref<boolean>(security.value || false)
|
|
40
|
+
|
|
41
|
+
// TODO refactoring and move to Sphere
|
|
42
|
+
const otp = ref<string>('')
|
|
43
|
+
const isOtpLoading = ref<boolean>(false)
|
|
44
|
+
|
|
45
|
+
const otpEnabledSuccess = ref<boolean>(false)
|
|
46
|
+
const otpErrorApiText = ref<string>('')
|
|
47
|
+
const otpDisabledErrorApiText = ref<string>('')
|
|
48
|
+
const onConfirm = async (): Promise<void> => {
|
|
49
|
+
otpErrorApiText.value = ''
|
|
50
|
+
isOtpLoading.value = true
|
|
51
|
+
const { data, error } = await useMyFetch<any, any>('ui/auth/2fa/confirm', {
|
|
52
|
+
method: 'POST',
|
|
53
|
+
body: {
|
|
54
|
+
otp: otp.value,
|
|
55
|
+
},
|
|
56
|
+
})
|
|
57
|
+
otpErrorApiText.value = error.value.data
|
|
58
|
+
if (data.value) {
|
|
59
|
+
otpEnabledSuccess.value = true
|
|
60
|
+
otpDisabledSuccess.value = false
|
|
61
|
+
initialSecurity.value = true
|
|
62
|
+
otp.value = ''
|
|
63
|
+
emits('confirm', true)
|
|
64
|
+
}
|
|
65
|
+
isOtpLoading.value = false
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const otpDisabledSuccess = ref<boolean>(false)
|
|
69
|
+
const onDisabled = async (): Promise<void> => {
|
|
70
|
+
isOtpLoading.value = true
|
|
71
|
+
const { data, error } = await useMyFetch<any, I_ErrorResponse>(
|
|
72
|
+
'ui/auth/2fa/disable',
|
|
73
|
+
{
|
|
74
|
+
method: 'POST',
|
|
75
|
+
body: {
|
|
76
|
+
otp: otp.value,
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
)
|
|
80
|
+
otpDisabledErrorApiText.value = error.value.data
|
|
81
|
+
if (data.value) {
|
|
82
|
+
otpDisabledSuccess.value = true
|
|
83
|
+
otpEnabledSuccess.value = false
|
|
84
|
+
initialSecurity.value = false
|
|
85
|
+
otp.value = ''
|
|
86
|
+
emits('confirm', false)
|
|
87
|
+
}
|
|
88
|
+
isOtpLoading.value = false
|
|
89
|
+
}
|
|
31
90
|
</script>
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<form id="time-format-form">
|
|
3
|
-
<div class="flex">
|
|
4
|
-
<ui-modal-icon>
|
|
5
|
-
<ui-icon-icon3 name="clock" width="20" height="20" />
|
|
6
|
-
</ui-modal-icon>
|
|
7
|
-
|
|
8
|
-
<div>
|
|
9
|
-
<div class="form-first-title">
|
|
10
|
-
{{ localization.common.timeFormat }}
|
|
11
|
-
</div>
|
|
12
|
-
<div class="form-second-title">
|
|
13
|
-
{{ props.description }}
|
|
14
|
-
</div>
|
|
15
|
-
<div
|
|
16
|
-
v-for="(item, key) in props.formatOptions"
|
|
17
|
-
:key="key"
|
|
18
|
-
class="radio"
|
|
19
|
-
>
|
|
20
|
-
<ui-radio
|
|
21
|
-
v-model="timeItem"
|
|
22
|
-
:test-id="item.testId"
|
|
23
|
-
:label="item.label"
|
|
24
|
-
:value="item.value"
|
|
25
|
-
size="md"
|
|
26
|
-
/>
|
|
27
|
-
</div>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
</form>
|
|
31
|
-
</template>
|
|
32
|
-
|
|
33
|
-
<script setup lang="ts">
|
|
34
|
-
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
35
|
-
import type { UI_I_RadioItem } from '~/components/common/layout/theHeader/userMenu/lib/models/interfaces'
|
|
36
|
-
import type { UI_T_TimeValue } from '~/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/lib/models/types'
|
|
37
|
-
|
|
38
|
-
const timeItem = defineModel<UI_T_TimeValue>()
|
|
39
|
-
|
|
40
|
-
const props = defineProps<{
|
|
41
|
-
description: string
|
|
42
|
-
formatOptions: UI_I_RadioItem[]
|
|
43
|
-
}>()
|
|
44
|
-
|
|
45
|
-
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
46
|
-
</script>
|
|
47
|
-
|
|
48
|
-
<style lang="scss" scoped>
|
|
49
|
-
.radio:not(:last-child) {
|
|
50
|
-
margin-bottom: 12px;
|
|
51
|
-
}
|
|
52
|
-
</style>
|
|
1
|
+
<template>
|
|
2
|
+
<form id="time-format-form">
|
|
3
|
+
<div class="flex">
|
|
4
|
+
<ui-modal-icon>
|
|
5
|
+
<ui-icon-icon3 name="clock" width="20" height="20" />
|
|
6
|
+
</ui-modal-icon>
|
|
7
|
+
|
|
8
|
+
<div>
|
|
9
|
+
<div class="form-first-title">
|
|
10
|
+
{{ localization.common.timeFormat }}
|
|
11
|
+
</div>
|
|
12
|
+
<div class="form-second-title">
|
|
13
|
+
{{ props.description }}
|
|
14
|
+
</div>
|
|
15
|
+
<div
|
|
16
|
+
v-for="(item, key) in props.formatOptions"
|
|
17
|
+
:key="key"
|
|
18
|
+
class="radio"
|
|
19
|
+
>
|
|
20
|
+
<ui-radio
|
|
21
|
+
v-model="timeItem"
|
|
22
|
+
:test-id="item.testId"
|
|
23
|
+
:label="item.label"
|
|
24
|
+
:value="item.value"
|
|
25
|
+
size="md"
|
|
26
|
+
/>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
</form>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
33
|
+
<script setup lang="ts">
|
|
34
|
+
import type { UI_I_Localization } from '~/lib/models/interfaces'
|
|
35
|
+
import type { UI_I_RadioItem } from '~/components/common/layout/theHeader/userMenu/lib/models/interfaces'
|
|
36
|
+
import type { UI_T_TimeValue } from '~/components/common/layout/theHeader/userMenu/modals/preferences/timeFormat/lib/models/types'
|
|
37
|
+
|
|
38
|
+
const timeItem = defineModel<UI_T_TimeValue>()
|
|
39
|
+
|
|
40
|
+
const props = defineProps<{
|
|
41
|
+
description: string
|
|
42
|
+
formatOptions: UI_I_RadioItem[]
|
|
43
|
+
}>()
|
|
44
|
+
|
|
45
|
+
const localization = computed<UI_I_Localization>(() => useLocal())
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<style lang="scss" scoped>
|
|
49
|
+
.radio:not(:last-child) {
|
|
50
|
+
margin-bottom: 12px;
|
|
51
|
+
}
|
|
52
|
+
</style>
|