mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Username and password server credentials. Specifically to allow connection to slack IRC.
This commit is contained in:
parent
4121abf5d2
commit
d0ff3621c2
@ -200,6 +200,14 @@
|
|||||||
<label for="node-config-input-nickname"><i class="fa fa-user"></i> <span data-i18n="irc.label.nickname"></span></label>
|
<label for="node-config-input-nickname"><i class="fa fa-user"></i> <span data-i18n="irc.label.nickname"></span></label>
|
||||||
<input type="text" id="node-config-input-nickname">
|
<input type="text" id="node-config-input-nickname">
|
||||||
</div>
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-config-input-username"><i class="fa fa-user"></i> <span data-i18n="irc.label.username"></span></label>
|
||||||
|
<input type="text" id="node-config-input-username">
|
||||||
|
</div>
|
||||||
|
<div class="form-row">
|
||||||
|
<label for="node-config-input-password"><i class="fa fa-lock"></i> <span data-i18n="irc.label.password"></span></label>
|
||||||
|
<input type="text" id="node-config-input-password">
|
||||||
|
</div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -210,7 +218,13 @@
|
|||||||
port: {value:"6667"},
|
port: {value:"6667"},
|
||||||
ssl: {value:false},
|
ssl: {value:false},
|
||||||
cert: {value:false},
|
cert: {value:false},
|
||||||
nickname: {value:"",required:true}
|
nickname: {value:"",required:true},
|
||||||
|
username: {value:""},
|
||||||
|
password: {value:""}
|
||||||
|
},
|
||||||
|
credentials: {
|
||||||
|
username: {type:"text"},
|
||||||
|
password: {type:"password"}
|
||||||
},
|
},
|
||||||
label: function() {
|
label: function() {
|
||||||
return this.server;
|
return this.server;
|
||||||
|
@ -27,6 +27,8 @@ module.exports = function(RED) {
|
|||||||
this.cert = n.cert || false;
|
this.cert = n.cert || false;
|
||||||
this.channel = n.channel;
|
this.channel = n.channel;
|
||||||
this.nickname = n.nickname;
|
this.nickname = n.nickname;
|
||||||
|
this.username = n.username;
|
||||||
|
this.password = n.password;
|
||||||
this.lastseen = 0;
|
this.lastseen = 0;
|
||||||
this.ircclient = null;
|
this.ircclient = null;
|
||||||
this.on("close", function() {
|
this.on("close", function() {
|
||||||
@ -49,7 +51,7 @@ module.exports = function(RED) {
|
|||||||
if (node.serverConfig.ircclient === null) {
|
if (node.serverConfig.ircclient === null) {
|
||||||
node.log(RED._("irc.errors.connect")+": "+node.serverConfig.server);
|
node.log(RED._("irc.errors.connect")+": "+node.serverConfig.server);
|
||||||
node.status({fill:"grey",shape:"dot",text:"node-red:common.status.connecting"});
|
node.status({fill:"grey",shape:"dot",text:"node-red:common.status.connecting"});
|
||||||
var options = {autoConnect:true,autoRejoin:false,floodProtection:true,secure:node.serverConfig.ssl,selfSigned:node.serverConfig.cert,port:node.serverConfig.port,retryDelay:20000};
|
var options = {autoConnect:true,autoRejoin:false,floodProtection:true,secure:node.serverConfig.ssl,selfSigned:node.serverConfig.cert,port:node.serverConfig.port,retryDelay:20000,userName:node.serverConfig.username,password:node.serverConfig.password};
|
||||||
node.serverConfig.ircclient = new irc.Client(node.serverConfig.server, node.serverConfig.nickname, options);
|
node.serverConfig.ircclient = new irc.Client(node.serverConfig.server, node.serverConfig.nickname, options);
|
||||||
node.serverConfig.ircclient.setMaxListeners(0);
|
node.serverConfig.ircclient.setMaxListeners(0);
|
||||||
node.serverConfig.ircclient.addListener('error', function(message) {
|
node.serverConfig.ircclient.addListener('error', function(message) {
|
||||||
@ -184,7 +186,7 @@ module.exports = function(RED) {
|
|||||||
if (node.serverConfig.ircclient === null) {
|
if (node.serverConfig.ircclient === null) {
|
||||||
node.log(RED._("irc.errors.connect")+": "+node.serverConfig.server);
|
node.log(RED._("irc.errors.connect")+": "+node.serverConfig.server);
|
||||||
node.status({fill:"grey",shape:"dot",text:"node-red:common.status.connecting"});
|
node.status({fill:"grey",shape:"dot",text:"node-red:common.status.connecting"});
|
||||||
var options = {autoConnect:true,autoRejoin:false,floodProtection:true,secure:node.serverConfig.ssl,selfSigned:node.serverConfig.cert,port:node.serverConfig.port,retryDelay:20000};
|
var options = {autoConnect:true,autoRejoin:false,floodProtection:true,secure:node.serverConfig.ssl,selfSigned:node.serverConfig.cert,port:node.serverConfig.port,retryDelay:20000,userName:node.serverConfig.username,password:node.serverConfig.password};
|
||||||
node.serverConfig.ircclient = new irc.Client(node.serverConfig.server, node.serverConfig.nickname, options);
|
node.serverConfig.ircclient = new irc.Client(node.serverConfig.server, node.serverConfig.nickname, options);
|
||||||
node.serverConfig.ircclient.setMaxListeners(0);
|
node.serverConfig.ircclient.setMaxListeners(0);
|
||||||
node.serverConfig.ircclient.addListener('error', function(message) {
|
node.serverConfig.ircclient.addListener('error', function(message) {
|
||||||
|
Loading…
Reference in New Issue
Block a user