From 77aee0f064ae97850e3481834ab7f7c2b185fc2c Mon Sep 17 00:00:00 2001 From: n3wk Date: Thu, 15 Oct 2026 14:43:43 +0200 Subject: [PATCH] Add credentials support so token persists in Node-RED UI --- nodes/zammad-config.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/nodes/zammad-config.js b/nodes/zammad-config.js index e8195c6..3e54b8c 100644 --- a/nodes/zammad-config.js +++ b/nodes/zammad-config.js @@ -10,9 +10,9 @@ module.exports = function (RED) { node.baseUrl = (config.baseUrl || "https://example.com/api/v1").replace(/\/+$/, ""); node.useToken = config.useToken !== false; - node.token = config.token || ""; - node.username = config.username || ""; - node.password = config.password || ""; + node.token = (this.credentials && this.credentials.token) || config.token || ""; + node.username = (this.credentials && this.credentials.username) || config.username || ""; + node.password = (this.credentials && this.credentials.password) || config.password || ""; node.sendRequest = function (method, path, body, msgHeaders, callback) { const url = new URL(node.baseUrl + path); @@ -55,5 +55,11 @@ module.exports = function (RED) { }; } - RED.nodes.registerType("zammad-config", ZammadConfigNode); + RED.nodes.registerType("zammad-config", ZammadConfigNode, { + credentials: { + token: { type: "text" }, + username: { type: "text" }, + password: { type: "password" } + } + }); };