mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Update all nodes to credentials system and auth middleware
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!--
|
||||
Copyright 2014 Andrew D Lindsay @AndrewDLindsay
|
||||
Copyright 2014, 2015 Andrew D Lindsay @AndrewDLindsay
|
||||
http://blog.thiseldo.co.uk
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@@ -102,38 +102,11 @@
|
||||
// token -> credentials
|
||||
name: { value: ""}
|
||||
},
|
||||
credentials: {
|
||||
token: "password"
|
||||
},
|
||||
label: function() {
|
||||
return this.name||this.from;
|
||||
},
|
||||
oneditprepare: function() {
|
||||
$.getJSON('twilio-api/'+this.id,function(data) {
|
||||
if (data.hasToken) {
|
||||
$('#node-config-input-token').val('__PWRD__');
|
||||
} else {
|
||||
$('#node-config-input-token').val('');
|
||||
}
|
||||
|
||||
});
|
||||
},
|
||||
oneditsave: function() {
|
||||
var newToken = $('#node-config-input-token').val();
|
||||
if (newToken != '__PWRD__') {
|
||||
var credentials = {};
|
||||
credentials.token = newToken;
|
||||
$.ajax({
|
||||
url: 'twilio-api/'+this.id,
|
||||
type: 'POST',
|
||||
data: credentials,
|
||||
success:function(result){}
|
||||
});
|
||||
}
|
||||
},
|
||||
ondelete: function() {
|
||||
$.ajax({
|
||||
url: 'twilio-api/'+this.id,
|
||||
type: 'DELETE',
|
||||
success: function(result) {}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user