Commit 8a23e950 by Chavee Issariyapat

fix error

parent edd44052
...@@ -9,10 +9,9 @@ var LRU = require("lru-cache"), ...@@ -9,10 +9,9 @@ var LRU = require("lru-cache"),
}); });
var debug = false; var debug = false;
// var authclient = require('seneca')({log: 'silent'}) var authclient = require('seneca')({log: 'silent'})
// .client({port: config.get('authserv_port'), host: config.get('authserv_host')}); .client({port: config.get('authserv_port'), host: config.get('authserv_host')});
// for testing
function authCheck(client_id, token, password, callback) { function authCheck(client_id, token, password, callback) {
verify(token, (err, decoded) => { verify(token, (err, decoded) => {
...@@ -22,32 +21,30 @@ function authCheck(client_id, token, password, callback) { ...@@ -22,32 +21,30 @@ function authCheck(client_id, token, password, callback) {
* decode.exp * decode.exp
*/ */
if (err) { if (err) {
callback(false) authclient.act({role:'auth',cmd:'token',action:'info',token: token}, function(err, res) {
if (debug) {
console.log("res ------>\n");
console.log(res);
} }
else {
// authclient.act({role:'auth',cmd:'token',action:'info',token: token}, function(err, res) {
// if (debug) {
// console.log("res ------>\n");
// console.log(res);
// }
// if (res && res.data) { if (res && res.data) {
// try { try {
// var jdata = JSON.parse(res.data); var jdata = JSON.parse(res.data);
// if (jdata && jdata.code == 200) { if (jdata && jdata.code == 200) {
// callback(true); callback(true);
// } }
// else callback(false); else callback(false);
// } catch (e) { } catch (e) {
// callback(false); callback(false);
// } }
// callback(true); callback(true);
// } }
// else { else {
// callback(false); callback(false);
// } }
// }); });
}
else {
callback(true) callback(true)
} }
}) })
......
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