Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
vernemq
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
stack
vernemq
Commits
8a23e950
Commit
8a23e950
authored
Sep 16, 2018
by
Chavee Issariyapat
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix error
parent
edd44052
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
27 deletions
+24
-27
authhook/auth_on_register.js
+24
-27
No files found.
authhook/auth_on_register.js
View file @
8a23e950
...
@@ -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
)
}
}
})
})
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment