17
17
</b-col >
18
18
</b-row >
19
19
20
- <b-form @submit.prevent =" submitForm " >
20
+ <b-form @submit.prevent =" submitPassword " >
21
21
<b-row >
22
22
<b-col sm =" 8" md =" 6" xl =" 3" >
23
23
<page-section
52
52
:state =" getValidationState($v.form.newPassword)"
53
53
data-test-id =" profileSettings-input-newPassword"
54
54
class =" form-control-with-button"
55
- @input =" $v.form.newPassword.$touch()"
56
55
/>
57
56
<b-form-invalid-feedback role =" alert" >
57
+ <template v-if =" ! $v .form .newPassword .required " >
58
+ {{ $t('global.form.fieldRequired') }}
59
+ </template >
58
60
<template
59
- v-if ="
61
+ v-else- if ="
60
62
! $v .form .newPassword .minLength ||
61
63
! $v .form .newPassword .maxLength
62
64
"
86
88
:state =" getValidationState($v.form.confirmPassword)"
87
89
data-test-id =" profileSettings-input-confirmPassword"
88
90
class =" form-control-with-button"
89
- @input =" $v.form.confirmPassword.$touch()"
90
91
/>
91
92
<b-form-invalid-feedback role =" alert" >
92
- <template v-if =" ! $v .form .confirmPassword .sameAsPassword " >
93
+ <template v-if =" ! $v .form .confirmPassword .required " >
94
+ {{ $t('global.form.fieldRequired') }}
95
+ </template >
96
+ <template v-else-if =" ! $v .form .confirmPassword .sameAsPassword " >
93
97
{{ $t('pageProfileSettings.passwordsDoNotMatch') }}
94
98
</template >
95
99
</b-form-invalid-feedback >
98
102
</page-section >
99
103
</b-col >
100
104
</b-row >
105
+ <b-row class =" mb-5" >
106
+ <b-col >
107
+ <b-button
108
+ variant =" primary"
109
+ type =" submit"
110
+ data-test-id =" profileSettings-button-savePassword"
111
+ >
112
+ {{ $t('global.action.save') }}
113
+ </b-button >
114
+ </b-col >
115
+ </b-row >
116
+ </b-form >
117
+ <b-form @submit.prevent =" submitForm" >
101
118
<page-section :section-title =" $t('pageProfileSettings.timezoneDisplay')" >
102
119
<p >{{ $t('pageProfileSettings.timezoneDisplayDesc') }}</p >
103
120
<b-row >
140
157
import BVToastMixin from ' @/components/Mixins/BVToastMixin' ;
141
158
import InfoTooltipPassword from ' @/components/Global/InfoTooltipPassword' ;
142
159
import InputPasswordToggle from ' @/components/Global/InputPasswordToggle' ;
143
- import { maxLength , minLength , sameAs } from ' vuelidate/lib/validators' ;
160
+ import {
161
+ required ,
162
+ maxLength ,
163
+ minLength ,
164
+ sameAs ,
165
+ } from ' vuelidate/lib/validators' ;
144
166
import LoadingBarMixin from ' @/components/Mixins/LoadingBarMixin' ;
145
167
import LocalTimezoneLabelMixin from ' @/components/Mixins/LocalTimezoneLabelMixin' ;
146
168
import PageTitle from ' @/components/Global/PageTitle' ;
@@ -164,8 +186,8 @@ export default {
164
186
data () {
165
187
return {
166
188
form: {
167
- newPassword: ' ' ,
168
- confirmPassword: ' ' ,
189
+ newPassword: null ,
190
+ confirmPassword: null ,
169
191
isUtcDisplay: this .$store .getters [' global/isUtcDisplay' ],
170
192
},
171
193
};
@@ -209,10 +231,12 @@ export default {
209
231
return {
210
232
form: {
211
233
newPassword: {
234
+ required,
212
235
minLength: minLength (this .passwordRequirements .minLength ),
213
236
maxLength: maxLength (this .passwordRequirements .maxLength ),
214
237
},
215
238
confirmPassword: {
239
+ required,
216
240
sameAsPassword: sameAs (' newPassword' ),
217
241
},
218
242
},
@@ -251,11 +275,11 @@ export default {
251
275
);
252
276
},
253
277
submitForm () {
254
- if (this .form .confirmPassword || this .form .newPassword ) {
255
- this .saveNewPasswordInputData ();
256
- }
257
278
this .saveTimeZonePrefrenceData ();
258
279
},
280
+ submitPassword () {
281
+ this .saveNewPasswordInputData ();
282
+ },
259
283
},
260
284
};
261
285
< / script>
0 commit comments