Skip to content

Commit c0ff23e

Browse files
authored
Merge pull request #4 from open-inc/fix/url-encoded-pw
fix: use URL encoding for password and username
2 parents b92d0a4 + 4b6d74d commit c0ff23e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

  • src/nodes/openware-config/openware-config.html

src/nodes/openware-config/openware-config.html/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ RED.nodes.registerType<OpenwareConfigEditorNodeProperties>("openware-config", {
2929
const node = this;
3030
const host = $("#node-config-input-host").val();
3131
const port = $("#node-config-input-port").val();
32-
const username = $("#node-config-input-username").val();
33-
let password = $("#node-config-input-password").val();
32+
const username = $("#node-config-input-username").val() as string;
33+
let password = $("#node-config-input-password").val() as (string | undefined);
3434
if (password === "__PWRD__") {
3535
password = undefined;
3636
}
3737

3838
if (host && port && username && password) {
39-
const url = `${host}:${port}/api/users/login?username=${username}&password=${password}`;
39+
const url = `${host}:${port}/api/users/login?username=${encodeURIComponent(username)}&password=${encodeURIComponent(password)}`;
4040
console.log("Refreshing session", url);
4141
const resp = await fetch(url);
4242
const data = await resp.json();

0 commit comments

Comments
 (0)