[fix] User edition: alias and password change

This commit is contained in:
ljf (zamentur) 2021-06-02 19:42:30 +02:00 committed by GitHub
parent 03776af0b9
commit 48b86b6642
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -273,13 +273,17 @@ 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('_', '-')
const newKey = key.replace('_', '').replace('es', '') const newKey = key.replace('_', '').replace('es', '')
const addDiff = arrayDiff(formData[key], user[dashedKey]) const addDiff = arrayDiff(formData[key], user[dashedKey])
const rmDiff = arrayDiff(user[dashedKey], formData[key]) const rmDiff = arrayDiff(user[dashedKey], formData[key])
if (addDiff.length) data['add_' + newKey] = addDiff if (addDiff.length) data['add_' + newKey + '[]'] = addDiff
if (rmDiff.length) data['remove_' + newKey] = rmDiff if (rmDiff.length) data['remove_' + newKey + '[]'] = rmDiff
} }
for (const key in formData) { for (const key in formData) {