feat: only send password from the frontend if it has changed
This commit is contained in:
@@ -65,6 +65,7 @@ export default {
|
||||
async updateInbox() {
|
||||
try {
|
||||
this.loading = true;
|
||||
|
||||
let payload = {
|
||||
id: this.inbox.id,
|
||||
formData: false,
|
||||
@@ -73,11 +74,16 @@ export default {
|
||||
imap_address: this.address,
|
||||
imap_port: this.port,
|
||||
imap_login: this.login,
|
||||
imap_password: this.password,
|
||||
imap_enable_ssl: this.isSSLEnabled,
|
||||
},
|
||||
};
|
||||
|
||||
// If the password is a placeholder, don't send it to the server
|
||||
const isPlaceholderPassword = /^\*+$/.test(this.password);
|
||||
if (!isPlaceholderPassword) {
|
||||
payload.channel.imap_password = this.password;
|
||||
}
|
||||
|
||||
if (!this.isIMAPEnabled) {
|
||||
payload.channel.smtp_enabled = false;
|
||||
}
|
||||
|
||||
@@ -134,7 +134,6 @@ export default {
|
||||
smtp_address: this.address,
|
||||
smtp_port: this.port,
|
||||
smtp_login: this.login,
|
||||
smtp_password: this.password,
|
||||
smtp_domain: this.domain,
|
||||
smtp_enable_ssl_tls: this.ssl,
|
||||
smtp_enable_starttls_auto: this.starttls,
|
||||
@@ -142,6 +141,12 @@ export default {
|
||||
smtp_authentication: this.authMechanism,
|
||||
},
|
||||
};
|
||||
|
||||
const isPlaceholderPassword = /^\*+$/.test(this.password);
|
||||
if (!isPlaceholderPassword) {
|
||||
payload.channel.smtp_password = this.password;
|
||||
}
|
||||
|
||||
await this.$store.dispatch('inboxes/updateInboxSMTP', payload);
|
||||
useAlert(this.$t('INBOX_MGMT.SMTP.EDIT.SUCCESS_MESSAGE'));
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user