Fix user password change not working properly

This commit is contained in:
Alexandre Aubin 2021-08-14 16:56:10 +02:00
parent 0e283acc9a
commit c26c4c9daa

View file

@ -99,7 +99,7 @@
<hr> <hr>
<!-- USER PASSWORD --> <!-- USER PASSWORD -->
<form-field v-bind="fields.password" v-model="form.password" :validation="$v.form.password" /> <form-field v-bind="fields.change_password" v-model="form.change_password" :validation="$v.form.change_password" />
<!-- USER PASSWORD CONFIRMATION --> <!-- USER PASSWORD CONFIRMATION -->
<form-field v-bind="fields.confirmation" v-model="form.confirmation" :validation="$v.form.confirmation" /> <form-field v-bind="fields.confirmation" v-model="form.confirmation" :validation="$v.form.confirmation" />
@ -142,7 +142,7 @@ export default {
mailbox_quota: '', mailbox_quota: '',
mail_aliases: [], mail_aliases: [],
mail_forward: [], mail_forward: [],
password: '', change_password: '',
confirmation: '' confirmation: ''
}, },
@ -201,11 +201,11 @@ export default {
} }
}, },
password: { change_password: {
label: this.$i18n.t('password'), label: this.$i18n.t('password'),
description: this.$i18n.t('good_practices_about_user_password'), description: this.$i18n.t('good_practices_about_user_password'),
descriptionVariant: 'warning', descriptionVariant: 'warning',
props: { id: 'password', type: 'password', placeholder: '••••••••' } props: { id: 'change_password', type: 'password', placeholder: '••••••••' }
}, },
confirmation: { confirmation: {
@ -236,8 +236,8 @@ export default {
mail_forward: { mail_forward: {
$each: { required, emailForward } $each: { required, emailForward }
}, },
password: { passwordLenght: minLength(8) }, change_password: { passwordLenght: minLength(8) },
confirmation: { passwordMatch: sameAs('password') } confirmation: { passwordMatch: sameAs('change_password') }
} }
}, },
@ -273,9 +273,6 @@ export default {
if (!Object.prototype.hasOwnProperty.call(formData, 'mailbox_quota')) { if (!Object.prototype.hasOwnProperty.call(formData, 'mailbox_quota')) {
formData.mailbox_quota = '' formData.mailbox_quota = ''
} }
if (Object.prototype.hasOwnProperty.call(formData, 'password')) {
formData['change-password'] = formData.password
}
for (const key of ['mail_aliases', 'mail_forward']) { for (const key of ['mail_aliases', 'mail_forward']) {
const dashedKey = key.replace('_', '-') const dashedKey = key.replace('_', '-')