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
b0008ed3
Commit
b0008ed3
authored
Nov 19, 2018
by
zCaesar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
e46d316b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
5 additions
and
4 deletions
+5
-4
authhook/auth_on_register.js
+2
-1
authhook/redis/on_message.js
+1
-1
authhook/redis/on_offline.js
+1
-1
authhook/redis/on_register.js
+1
-1
No files found.
authhook/auth_on_register.js
View file @
b0008ed3
...
...
@@ -30,6 +30,7 @@ function authCheck(client_id, token, password, callback) {
seneca
.
act
(
'ms:tokenregistry, cmd:getAttributes, type:device, tokencode:'
+
token
,
function
(
err
,
res
)
{
console
.
log
(
'result : '
+
util
.
inspect
(
res
.
result
,
false
,
null
,
true
))
if
(
res
.
result
)
{
console
.
log
(
res
.
result
)
var
token_profile
=
(
res
&&
res
.
result
&&
res
.
result
[
0
])
?
res
.
result
[
0
]
:
{};
var
mqttauth
=
{
clientid
:
client_id
,
...
...
@@ -103,7 +104,7 @@ module.exports = function (options = {}) {
// cache missed
authCheck
(
req
.
body
.
client_id
,
req
.
body
.
username
,
req
.
body
.
password
,
function
(
result
)
{
cache
.
set
(
cachekey
,
result
);
if
(
!
result
)
{
if
(
result
)
{
require
(
'./redis/on_register'
).
on_register_redis
(
req
.
body
.
client_id
).
then
(
status
=>
{
console
.
log
(
'redis:status: '
+
status
)
res
.
send
({
...
...
authhook/redis/on_message.js
View file @
b0008ed3
...
...
@@ -3,7 +3,7 @@ var redis = new Redis()
function
on_message_redis
(
deviceid
,
payload
)
{
// first time to access on authhook auth_on_register
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
deviceid
.
indexOf
(
'mqtt'
)
===
0
&&
deviceid
.
length
!==
36
)
{
if
(
deviceid
.
indexOf
(
'mqtt'
)
===
0
||
deviceid
.
length
!==
36
)
{
console
.
log
(
deviceid
)
resolve
(
true
)
}
...
...
authhook/redis/on_offline.js
View file @
b0008ed3
...
...
@@ -3,7 +3,7 @@ var redis = new Redis()
function
on_offline_redis
(
deviceid
)
{
// first time to access on authhook auth_on_register
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
deviceid
.
indexOf
(
'mqtt'
)
===
0
&&
deviceid
.
length
!==
36
)
{
if
(
deviceid
.
indexOf
(
'mqtt'
)
===
0
||
deviceid
.
length
!==
36
)
{
resolve
(
true
)
}
else
{
...
...
authhook/redis/on_register.js
View file @
b0008ed3
...
...
@@ -3,7 +3,7 @@ var redis = new Redis()
function
on_register_redis
(
deviceid
)
{
// first time to access on authhook auth_on_register
return
new
Promise
((
resolve
,
reject
)
=>
{
if
(
deviceid
.
indexOf
(
'mqtt'
)
===
0
&&
deviceid
.
length
!==
36
)
{
if
(
deviceid
.
indexOf
(
'mqtt'
)
===
0
||
deviceid
.
length
!==
36
)
{
resolve
(
true
)
}
else
{
...
...
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