Fix relay UI password display
This commit is contained in:
10
src/mail.js
10
src/mail.js
@@ -791,8 +791,8 @@ async function clearDomains() {
|
||||
// remove all fields that should never be sent out via REST API
|
||||
function removePrivateFields(domain) {
|
||||
const result = _.pick(domain, ['domain', 'enabled', 'mailFromValidation', 'catchAll', 'relay', 'banner']);
|
||||
if (result.relay.provider !== 'cloudron-smtp') {
|
||||
if (result.relay.username === result.relay.password) result.relay.username = constants.SECRET_PLACEHOLDER;
|
||||
if ('password' in result.relay) {
|
||||
if ('username' in result.relay && result.relay.username === result.relay.password) result.relay.username = constants.SECRET_PLACEHOLDER;
|
||||
result.relay.password = constants.SECRET_PLACEHOLDER;
|
||||
}
|
||||
return result;
|
||||
@@ -838,10 +838,8 @@ async function setMailRelay(domain, relay, options) {
|
||||
if (!domain) throw new BoxError(BoxError.NOT_FOUND, 'Mail domain not found');
|
||||
|
||||
// inject current username/password
|
||||
if (result.relay.provider === relay.provider) {
|
||||
if (relay.username === constants.SECRET_PLACEHOLDER) relay.username = result.relay.username;
|
||||
if (relay.password === constants.SECRET_PLACEHOLDER) relay.password = result.relay.password;
|
||||
}
|
||||
if (relay.username === constants.SECRET_PLACEHOLDER) relay.username = result.relay.username;
|
||||
if (relay.password === constants.SECRET_PLACEHOLDER) relay.password = result.relay.password;
|
||||
|
||||
if (!options.skipVerify) {
|
||||
const error = await verifyRelay(relay);
|
||||
|
||||
Reference in New Issue
Block a user