aboutsummaryrefslogtreecommitdiff
path: root/controllers
diff options
context:
space:
mode:
authorpitu <[email protected]>2017-01-17 00:37:54 -0300
committerpitu <[email protected]>2017-01-17 00:37:54 -0300
commitbdfd512c10986a9b4f137e668be6bd80dbd8f617 (patch)
treef64f3cbcd5888916f8a388f62873732687db934d /controllers
parentLogin screen on dashboard (diff)
downloadhost.fuwn.me-bdfd512c10986a9b4f137e668be6bd80dbd8f617.tar.xz
host.fuwn.me-bdfd512c10986a9b4f137e668be6bd80dbd8f617.zip
token handling and verification
Diffstat (limited to 'controllers')
-rw-r--r--controllers/galleryController.js8
-rw-r--r--controllers/uploadController.js7
2 files changed, 7 insertions, 8 deletions
diff --git a/controllers/galleryController.js b/controllers/galleryController.js
index 8bcdd1e..0f64086 100644
--- a/controllers/galleryController.js
+++ b/controllers/galleryController.js
@@ -5,18 +5,18 @@ let galleryController = {}
galleryController.list = function(req, res, next){
- if(config.TOKEN === true)
+ if(config.private === true)
if(req.headers.auth !== config.clientToken)
return res.status(401).send('not-authorized')
- db.table('gallery').select('id', 'name').then((data) => {
- res.json({ data })
+ db.table('gallery').select('id', 'name').then((galleries) => {
+ return res.json({ galleries })
})
}
galleryController.test = function(req, res, next){
- if(config.TOKEN === true)
+ if(config.private === true)
if(req.headers.auth !== config.clientToken)
return res.status(401).send('not-authorized')
diff --git a/controllers/uploadController.js b/controllers/uploadController.js
index a374137..c9959fb 100644
--- a/controllers/uploadController.js
+++ b/controllers/uploadController.js
@@ -22,7 +22,7 @@ const upload = multer({
uploadsController.upload = function(req, res, next){
- if(config.TOKEN === true)
+ if(config.private === true)
if(req.headers.auth !== config.clientToken)
return res.status(401).send('not-authorized')
@@ -70,9 +70,8 @@ uploadsController.upload = function(req, res, next){
uploadsController.list = function(req, res){
- if(config.TOKEN === true)
- if(req.headers.auth !== config.clientToken)
- return res.status(401).send('not-authorized')
+ if(req.headers.auth !== config.adminToken)
+ return res.status(401).send('not-authorized')
db.table('files').then((files) => {