Commit af819036 by zCaesar

edit auth

parent 99c5a125
...@@ -30,15 +30,15 @@ function authCheck(client_id, token, password, callback) { ...@@ -30,15 +30,15 @@ function authCheck(client_id, token, password, callback) {
console.log('token :' + token) console.log('token :' + token)
seneca.act('ms:tokenregistry, cmd:getAttributes, type:device, tokencode:' + token, function (err, res) { seneca.act('ms:tokenregistry, cmd:getAttributes, type:device, tokencode:' + token, function (err, res) {
console.log('result : ' + util.inspect(res.result, false, null, true)) console.log('result : ' + util.inspect(res.result, false, null, true))
if (res.result) { if (res.result.length > 0) {
console.log(res.result) console.log(res.result)
var token_profile = (res && res.result && res.result[0]) ? res.result[0] : {}; var token_profile = (res && res.result) ? res.result : {};
var mqttauth = { var mqttauth = {
clientid: client_id, clientid: client_id,
token: token, token: token,
password: password password: password
}; };
console.log(util.inspect(validator.auth_connect(mqttauth, token_profile), false, null, true)) console.log('validator:', util.inspect(validator.auth_connect(mqttauth, token_profile), false, null, true))
callback(validator.auth_connect(mqttauth, token_profile).status); callback(validator.auth_connect(mqttauth, token_profile).status);
} }
else { else {
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
"device_registry_host" : "alpha.nexpie.io", "device_registry_host" : "alpha.nexpie.io",
"device_registry_port" : 8990, "device_registry_port" : 8990,
"token_registry_host" : "alpha.nexpie.io", "token_registry_host" : "localhost",
"token_registry_port" : 8790, "token_registry_port" : 8790,
"auth_on_register_debug" : true, "auth_on_register_debug" : true,
......
...@@ -10,4 +10,4 @@ module.exports = function (options = {}) { ...@@ -10,4 +10,4 @@ module.exports = function (options = {}) {
res.status(200); res.status(200);
res.send(''); res.send('');
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment