mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Ensure that a client id is set if autoUnsubscribe is disabled
This commit is contained in:
parent
182361c176
commit
c94f0896e1
@ -489,17 +489,23 @@
|
|||||||
tls: {type:"tls-config",required: false,
|
tls: {type:"tls-config",required: false,
|
||||||
label:RED._("node-red:mqtt.label.use-tls") },
|
label:RED._("node-red:mqtt.label.use-tls") },
|
||||||
clientid: {value:"", validate: function(v, opt) {
|
clientid: {value:"", validate: function(v, opt) {
|
||||||
var ok = false;
|
let ok = true;
|
||||||
if ($("#node-config-input-clientid").length) {
|
if ($("#node-config-input-clientid").length) {
|
||||||
// Currently editing the node
|
// Currently editing the node
|
||||||
ok = $("#node-config-input-cleansession").is(":checked") || (v||"").length > 0;
|
let needClientId = !$("#node-config-input-cleansession").is(":checked") || !$("#node-config-input-autoUnsubscribe").is(":checked")
|
||||||
|
if (needClientId) {
|
||||||
|
ok = (v||"").length > 0;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ok = (this.cleansession===undefined || this.cleansession) || (v||"").length > 0;
|
let needClientId = !(this.cleansession===undefined || this.cleansession) || this.autoUnsubscribe;
|
||||||
|
if (needClientId) {
|
||||||
|
ok = (v||"").length > 0;
|
||||||
}
|
}
|
||||||
if (ok) {
|
|
||||||
return ok;
|
|
||||||
}
|
}
|
||||||
|
if (!ok) {
|
||||||
return RED._("node-red:mqtt.errors.invalid-client-id");
|
return RED._("node-red:mqtt.errors.invalid-client-id");
|
||||||
|
}
|
||||||
|
return true;
|
||||||
}},
|
}},
|
||||||
autoConnect: {value: true},
|
autoConnect: {value: true},
|
||||||
usetls: {value: false},
|
usetls: {value: false},
|
||||||
|
Loading…
Reference in New Issue
Block a user