Update all nodes to credentials system and auth middleware

This commit is contained in:
Nick O'Leary
2015-02-06 21:10:14 +00:00
parent f4fdebfba5
commit 08791f1914
29 changed files with 177 additions and 783 deletions

View File

@@ -1,6 +1,6 @@
<!--
Copyright 2014 Charalampos Doukas, @BuildingIoT
Copyright 2014, 2015 Charalampos Doukas, @BuildingIoT
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
</div>
<div class="form-row">
<label for="node-input-appkey_sub"><i class="fa fa-lock"></i> App Key</label>
<input type="text" id="node-input-appkey_sub" placeholder="key">
<input type="text" id="node-input-pusherappkey_sub" placeholder="key">
</div>
<div class="form-row">
@@ -51,6 +51,9 @@
channel: {value:"", required:true},
eventname: {value:"", required:true}
},
credentials: {
pusherappkey_sub: "text"
},
inputs:0, // set the number of inputs - only 0 or 1
outputs:1, // set the number of outputs - 0 to n
icon: "pusher.png", // set the icon (held in public/icons)
@@ -59,31 +62,6 @@
},
labelStyle: function() { // sets the class to apply to the label
return this.name?"node_label_italic":"";
},
oneditsave: function() {
var credentials = {};
var newAppKey_sub = $('#node-input-appkey_sub').val();
credentials.pusherappkey_sub = newAppKey_sub;
$.ajax({
url: 'pusher/'+this.id,
type: 'POST',
data: credentials,
success: function(result){}
});
},
oneditprepare: function() {
$.getJSON('pusher/'+this.id,function(data) {
if (data.pusherappkey_sub) {
$('#node-input-appkey_sub').val(data.pusherappkey_sub);
}
});
},
ondelete: function() {
$.ajax({
url: 'pusher/'+this.id,
type: 'DELETE',
success: function(result) {}
});
}
});
</script>
@@ -101,17 +79,17 @@
<div class="form-row">
<label for="node-input-appid"><i class="fa fa-tag"></i> App ID</label>
<input type="text" id="node-input-appid" placeholder="app_id">
<input type="text" id="node-input-pusherappid" placeholder="app_id">
</div>
<div class="form-row">
<label for="node-input-appkey"><i class="fa fa-lock"></i> App Key</label>
<input type="text" id="node-input-appkey" placeholder="key">
<input type="text" id="node-input-pusherappkey" placeholder="key">
</div>
<div class="form-row">
<label for="node-input-topic"><i class="fa fa-asterisk"></i> App Secret</label>
<input type="password" id="node-input-appsecret" placeholder="secret">
<input type="password" id="node-input-pusherappsecret" placeholder="secret">
</div>
<div class="form-row">
@@ -135,6 +113,11 @@
channel: {value:"", required:true},
eventname: {value:"", required:true}
},
credentials: {
pusherappid: {type:"text"},
pusherappkey: {type:"text"},
pusherappsecret: {type:"password"}
},
inputs:1, // set the number of inputs - only 0 or 1
outputs:0, // set the number of outputs - 0 to n
icon: "pusher.png", // set the icon (held in public/icons)
@@ -144,41 +127,6 @@
},
labelStyle: function() { // sets the class to apply to the label
return this.name?"node_label_italic":"";
},
oneditsave: function() {
var credentials = {};
var newAppID = $('#node-input-appid').val();
var newAppKey = $('#node-input-appkey').val();
var newAppSecret = $('#node-input-appsecret').val();
credentials.pusherappid = newAppID;
credentials.pusherappkey = newAppKey;
credentials.pusherappsecret = newAppSecret;
$.ajax({
url: 'pusher/'+this.id,
type: 'POST',
data: credentials,
success: function(result){}
});
},
oneditprepare: function() {
$.getJSON('pusher/'+this.id,function(data) {
if (data.pusherappid) {
$('#node-input-appid').val(data.pusherappid);
}
if (data.pusherappkey) {
$('#node-input-appkey').val(data.pusherappkey);
}
if (data.pusherappsecret) {
$('#node-input-appsecret').val(data.pusherappsecret);
}
});
},
ondelete: function() {
$.ajax({
url: 'pusher/'+this.id,
type: 'DELETE',
success: function(result) {}
});
}
});
</script>