1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Fix basic auth with empty username or password

fix for #3324
This commit is contained in:
Ben Hardill 2022-01-05 20:56:46 +00:00
parent aaa2b4c3db
commit 44616c6872
No known key found for this signature in database
GPG Key ID: 74DD076979ABB1E7

View File

@ -302,6 +302,8 @@ in your Node-RED user directory (${RED.settings.userDir}).
// var cred = "" // var cred = ""
if (this.credentials.user || this.credentials.password) { if (this.credentials.user || this.credentials.password) {
// cred = `${this.credentials.user}:${this.credentials.password}`; // cred = `${this.credentials.user}:${this.credentials.password}`;
if (this.credentials.user === undefined) { this.credentials.user = ""}
if (this.credentials.password === undefined) { this.credentials.password = ""}
opts.headers.Authorization = "Basic " + Buffer.from(`${this.credentials.user}:${this.credentials.password}`).toString("base64"); opts.headers.Authorization = "Basic " + Buffer.from(`${this.credentials.user}:${this.credentials.password}`).toString("base64");
} }
// build own basic auth header // build own basic auth header