FrontEnd for credentials

This commit is contained in:
Antoine Aflalo
2014-04-20 13:51:45 +03:00
parent f4e1d4f015
commit e85d1705a8
2 changed files with 70 additions and 5 deletions

View File

@@ -28,12 +28,12 @@ var querystring = require('querystring');
//REST API for credentials
RED.httpAdmin.get('/pushbullet-api/global',function(req,res) {
res.send(JSON.stringify({hasApiKey:!(pushkey && pushkey.pushbullet && pushkey.deviceid)}));
res.send(JSON.stringify({hasApiKey:(pushkey && pushkey.pushbullet && pushkey.deviceid && pushkey.pushbullet != '' && pushkey.deviceid !='')}));
});
RED.httpAdmin.get('/pushbullet-api/:id',function(req,res) {
var credentials = RED.nodes.getCredentials(req.params.id);
if (credentials) {
res.send(JSON.stringify({hasApiKey:(credentials.apikey&&credentials.apikey!="")}));
res.send(JSON.stringify({hasApiKey:(credentials.apikey && credentials.apikey!="")}));
} else {
res.send(JSON.stringify({}));
}