diff --git a/nodes/http-auth.js b/nodes/http-auth.js index caac187..d122e3f 100644 --- a/nodes/http-auth.js +++ b/nodes/http-auth.js @@ -50,9 +50,9 @@ module.exports = function (RED) { let src = 'inline'; let realm = config.realm.trim(); let realmL = realm.toLowerCase(); - let username = config.username.trim(); - let usernameL = username.toLowerCase(); - let password = config.password; + const username = config.username.trim(); + const usernameL = username.toLowerCase(); + const password = config.password; let getUser = function (_realm, _username) { if (_realm.trim().toLowerCase() === realmL && _username.trim().toLowerCase() === usernameL) { return { @@ -64,14 +64,12 @@ module.exports = function (RED) { return null; }; - const cred = RED.nodes.getNode(config.cred); - if (cred) { - src = 'cred'; - realm = cred.realm.trim(); + const multiple = RED.nodes.getNode(config.multiple); + if (multiple) { + src = 'multiple'; + realm = multiple.realm.trim(); realmL = realm.toLowerCase(); - username = cred.username.trim(); - usernameL = username.toLowerCase(); - password = cred.password; + getUser = multiple.getUser; } const file = RED.nodes.getNode(config.file); @@ -82,14 +80,6 @@ module.exports = function (RED) { getUser = file.getUser; } - const multiple = RED.nodes.getNode(config.multiple); - if (multiple) { - src = 'multiple'; - realm = multiple.realm.trim(); - realmL = realm.toLowerCase(); - getUser = multiple.getUser; - } - this.httpauthconf = {}; this.httpauthconf.src = src; this.httpauthconf.realm = realm;