Skip to content

Commit 353fb94

Browse files
committed
Added a Save button for each option on the profile settings page
- Previously there is one save button for Passwords and Timezone. Added a separate button for passwords in this change. Signed-off-by: Nikhil Ashoka <[email protected]>
1 parent 203a27a commit 353fb94

File tree

1 file changed

+35
-11
lines changed

1 file changed

+35
-11
lines changed

src/views/ProfileSettings/ProfileSettings.vue

+35-11
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
</b-col>
1818
</b-row>
1919

20-
<b-form @submit.prevent="submitForm">
20+
<b-form @submit.prevent="submitPassword">
2121
<b-row>
2222
<b-col sm="8" md="6" xl="3">
2323
<page-section
@@ -52,11 +52,13 @@
5252
:state="getValidationState($v.form.newPassword)"
5353
data-test-id="profileSettings-input-newPassword"
5454
class="form-control-with-button"
55-
@input="$v.form.newPassword.$touch()"
5655
/>
5756
<b-form-invalid-feedback role="alert">
57+
<template v-if="!$v.form.newPassword.required">
58+
{{ $t('global.form.fieldRequired') }}
59+
</template>
5860
<template
59-
v-if="
61+
v-else-if="
6062
!$v.form.newPassword.minLength ||
6163
!$v.form.newPassword.maxLength
6264
"
@@ -86,10 +88,12 @@
8688
:state="getValidationState($v.form.confirmPassword)"
8789
data-test-id="profileSettings-input-confirmPassword"
8890
class="form-control-with-button"
89-
@input="$v.form.confirmPassword.$touch()"
9091
/>
9192
<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">
9397
{{ $t('pageProfileSettings.passwordsDoNotMatch') }}
9498
</template>
9599
</b-form-invalid-feedback>
@@ -98,6 +102,19 @@
98102
</page-section>
99103
</b-col>
100104
</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">
101118
<page-section :section-title="$t('pageProfileSettings.timezoneDisplay')">
102119
<p>{{ $t('pageProfileSettings.timezoneDisplayDesc') }}</p>
103120
<b-row>
@@ -140,7 +157,12 @@
140157
import BVToastMixin from '@/components/Mixins/BVToastMixin';
141158
import InfoTooltipPassword from '@/components/Global/InfoTooltipPassword';
142159
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';
144166
import LoadingBarMixin from '@/components/Mixins/LoadingBarMixin';
145167
import LocalTimezoneLabelMixin from '@/components/Mixins/LocalTimezoneLabelMixin';
146168
import PageTitle from '@/components/Global/PageTitle';
@@ -164,8 +186,8 @@ export default {
164186
data() {
165187
return {
166188
form: {
167-
newPassword: '',
168-
confirmPassword: '',
189+
newPassword: null,
190+
confirmPassword: null,
169191
isUtcDisplay: this.$store.getters['global/isUtcDisplay'],
170192
},
171193
};
@@ -209,10 +231,12 @@ export default {
209231
return {
210232
form: {
211233
newPassword: {
234+
required,
212235
minLength: minLength(this.passwordRequirements.minLength),
213236
maxLength: maxLength(this.passwordRequirements.maxLength),
214237
},
215238
confirmPassword: {
239+
required,
216240
sameAsPassword: sameAs('newPassword'),
217241
},
218242
},
@@ -251,11 +275,11 @@ export default {
251275
);
252276
},
253277
submitForm() {
254-
if (this.form.confirmPassword || this.form.newPassword) {
255-
this.saveNewPasswordInputData();
256-
}
257278
this.saveTimeZonePrefrenceData();
258279
},
280+
submitPassword() {
281+
this.saveNewPasswordInputData();
282+
},
259283
},
260284
};
261285
</script>

0 commit comments

Comments
 (0)