domains: remove SECRET_PLACEHOLDER from responses
This commit is contained in:
+12
-12
@@ -1,15 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
exports = module.exports = {
|
||||
removePrivateFields,
|
||||
injectPrivateFields,
|
||||
upsert,
|
||||
get,
|
||||
del,
|
||||
wait,
|
||||
verifyDomainConfig
|
||||
};
|
||||
|
||||
const { ApiClient, Language } = require('domrobot-client'),
|
||||
assert = require('node:assert'),
|
||||
BoxError = require('../boxerror.js'),
|
||||
@@ -25,12 +15,12 @@ function formatError(response) {
|
||||
}
|
||||
|
||||
function removePrivateFields(domainObject) {
|
||||
domainObject.config.password = constants.SECRET_PLACEHOLDER;
|
||||
delete domainObject.config.password;
|
||||
return domainObject;
|
||||
}
|
||||
|
||||
function injectPrivateFields(newConfig, currentConfig) {
|
||||
if (newConfig.password === constants.SECRET_PLACEHOLDER) newConfig.password = currentConfig.password;
|
||||
if (!Object.hasOwn(newConfig, 'password')) newConfig.password = currentConfig.password;
|
||||
}
|
||||
|
||||
// https://www.inwx.com/en/help/apidoc/f/ch04.html
|
||||
@@ -217,3 +207,13 @@ async function verifyDomainConfig(domainObject) {
|
||||
|
||||
return credentials;
|
||||
}
|
||||
|
||||
exports = module.exports = {
|
||||
removePrivateFields,
|
||||
injectPrivateFields,
|
||||
upsert,
|
||||
get,
|
||||
del,
|
||||
wait,
|
||||
verifyDomainConfig
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user