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
56021c2a
Commit
56021c2a
authored
Dec 01, 2018
by
zCaesar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix error
parent
045aaf2a
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
14 deletions
+16
-14
authhook/auth_on_publish.js
+3
-3
authhook/auth_on_register.js
+6
-6
authhook/auth_on_subscribe.js
+3
-3
authhook/on_offline.js
+2
-0
authhook/on_unsubscribe.js
+2
-2
No files found.
authhook/auth_on_publish.js
View file @
56021c2a
...
@@ -34,7 +34,7 @@ module.exports = function (options = {}) {
...
@@ -34,7 +34,7 @@ module.exports = function (options = {}) {
if
(
decoded
)
{
if
(
decoded
)
{
if
(
decoded
.
role
===
'realtimedb'
)
response
=
{
'result'
:
'ok'
}
if
(
decoded
.
role
===
'realtimedb'
)
response
=
{
'result'
:
'ok'
}
else
response
=
{
'result'
:
'no'
}
else
response
=
{
result
:
{
error
:
'not allowed'
}
}
res
.
send
(
response
);
res
.
send
(
response
);
next
();
next
();
}
}
...
@@ -65,7 +65,7 @@ module.exports = function (options = {}) {
...
@@ -65,7 +65,7 @@ module.exports = function (options = {}) {
next
();
next
();
}
}
else
{
else
{
res
.
send
({
"result"
:
"no"
});
res
.
send
({
result
:
{
error
:
'not allowed'
}
});
next
();
next
();
}
}
});
});
...
@@ -75,7 +75,7 @@ module.exports = function (options = {}) {
...
@@ -75,7 +75,7 @@ module.exports = function (options = {}) {
}
}
else
{
else
{
res
.
send
({
"result"
:
"no"
});
res
.
send
({
result
:
{
error
:
'not allowed'
}
});
next
();
next
();
}
}
}
}
...
...
authhook/auth_on_register.js
View file @
56021c2a
...
@@ -114,13 +114,13 @@ module.exports = function (options = {}) {
...
@@ -114,13 +114,13 @@ module.exports = function (options = {}) {
// });
// });
// } else {
// } else {
// res.send({
// res.send({
// "result": "no"
// result: { error: 'not allowed' }
// });
// });
// }
// }
// })
// })
// } else {
// } else {
// res.send({
// res.send({
// "result": "no"
// result: {error: 'not allowed'}
// });
// });
// }
// }
// // const util = require('util')
// // const util = require('util')
...
@@ -137,13 +137,13 @@ module.exports = function (options = {}) {
...
@@ -137,13 +137,13 @@ module.exports = function (options = {}) {
// });
// });
// } else {
// } else {
// res.send({
// res.send({
// "result": "no"
// result: {error: 'not allowed'}
// });
// });
// }
// }
// })
// })
// } else {
// } else {
// res.send({
// res.send({
// "result": "no"
// result: {error: 'not allowed'}
// });
// });
// }
// }
// }
// }
...
@@ -156,7 +156,7 @@ module.exports = function (options = {}) {
...
@@ -156,7 +156,7 @@ module.exports = function (options = {}) {
});
});
}
else
{
}
else
{
res
.
send
({
res
.
send
({
"result"
:
{
'error'
:
"not allowed"
}
result
:
{
error
:
'not allowed'
}
});
});
}
}
})
})
...
@@ -164,7 +164,7 @@ module.exports = function (options = {}) {
...
@@ -164,7 +164,7 @@ module.exports = function (options = {}) {
}
}
else
{
else
{
res
.
send
({
res
.
send
({
"result"
:
"no"
result
:
{
error
:
'not allowed'
}
});
});
next
();
next
();
}
}
...
...
authhook/auth_on_subscribe.js
View file @
56021c2a
...
@@ -29,7 +29,7 @@ module.exports = function (options = {}) {
...
@@ -29,7 +29,7 @@ module.exports = function (options = {}) {
if
(
decoded
)
{
if
(
decoded
)
{
if
(
decoded
.
role
===
'realtimedb'
)
response
=
{
'result'
:
'ok'
}
if
(
decoded
.
role
===
'realtimedb'
)
response
=
{
'result'
:
'ok'
}
else
response
=
{
'result'
:
'no'
}
else
response
=
{
result
:
{
error
:
'not allowed'
}
}
res
.
send
(
response
);
res
.
send
(
response
);
next
();
next
();
}
}
...
@@ -56,14 +56,14 @@ module.exports = function (options = {}) {
...
@@ -56,14 +56,14 @@ module.exports = function (options = {}) {
next
();
next
();
}
}
else
{
else
{
res
.
send
({
"result"
:
"no"
});
res
.
send
({
result
:
{
error
:
'not allowed'
}
});
next
();
next
();
}
}
});
});
}
}
}
}
else
{
else
{
res
.
send
({
"result"
:
"no"
});
res
.
send
({
result
:
{
error
:
'not allowed'
}
});
next
();
next
();
}
}
}
}
...
...
authhook/on_offline.js
View file @
56021c2a
...
@@ -5,6 +5,8 @@ module.exports = function (options = {}) {
...
@@ -5,6 +5,8 @@ module.exports = function (options = {}) {
return
function
(
req
,
res
,
next
)
{
return
function
(
req
,
res
,
next
)
{
console
.
log
(
'auth_on_offline'
)
console
.
log
(
'auth_on_offline'
)
doRedis
(
req
.
body
.
client_id
)
doRedis
(
req
.
body
.
client_id
)
res
.
status
(
200
);
res
.
send
(
''
);
}
}
function
doRedis
(
client_id
)
{
function
doRedis
(
client_id
)
{
...
...
authhook/on_unsubscribe.js
View file @
56021c2a
...
@@ -13,7 +13,7 @@ module.exports = function(options = {}) {
...
@@ -13,7 +13,7 @@ module.exports = function(options = {}) {
if
(
decoded
.
role
===
'realtimedb'
)
{
if
(
decoded
.
role
===
'realtimedb'
)
{
response
=
{
'result'
:
'ok'
}
response
=
{
'result'
:
'ok'
}
}
}
else
response
=
{
'result'
:
'no'
}
else
response
=
{
result
:
{
error
:
'not allowed'
}
}
res
.
send
(
response
);
res
.
send
(
response
);
next
()
next
()
}
}
...
@@ -28,7 +28,7 @@ module.exports = function(options = {}) {
...
@@ -28,7 +28,7 @@ module.exports = function(options = {}) {
"topics"
:
[
_ftopic
]
"topics"
:
[
_ftopic
]
}
}
}
}
else
response
=
{
'result'
:
'no'
}
else
response
=
{
result
:
{
error
:
'not allowed'
}
}
if
(
options
.
debug
)
{
if
(
options
.
debug
)
{
console
.
log
(
'on_unsubscribe-------------'
);
console
.
log
(
'on_unsubscribe-------------'
);
...
...
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