diff --git a/server/model/monitor.js b/server/model/monitor.js index e407e5a2..2dc77fbd 100644 --- a/server/model/monitor.js +++ b/server/model/monitor.js @@ -230,10 +230,12 @@ class Monitor extends BeanModel { /** * Encode user and password to Base64 encoding * for HTTP "basic" auth, as per RFC-7617 + * @param {string|null} user - The username (nullable if not changed by a user) + * @param {string|null} pass - The password (nullable if not changed by a user) * @returns {string} */ encodeBase64(user, pass) { - return Buffer.from(user + ":" + pass).toString("base64"); + return Buffer.from(`${user || ""}:${pass || ""}`).toString("base64"); } /**