aboutsummaryrefslogtreecommitdiff
path: root/controllers
diff options
context:
space:
mode:
authorkanadeko <[email protected]>2017-01-16 04:45:29 -0300
committerkanadeko <[email protected]>2017-01-16 04:45:29 -0300
commit570f6c3ce3669571b05eeb6c8ebb2ca21d641a3c (patch)
tree40198cf3a89191a8b29b270b1f6725842584295a /controllers
parentAdded generation of random token (diff)
downloadhost.fuwn.me-570f6c3ce3669571b05eeb6c8ebb2ca21d641a3c.tar.xz
host.fuwn.me-570f6c3ce3669571b05eeb6c8ebb2ca21d641a3c.zip
Print and save tokens
Diffstat (limited to 'controllers')
-rw-r--r--controllers/galleryController.js8
-rw-r--r--controllers/uploadController.js8
2 files changed, 8 insertions, 8 deletions
diff --git a/controllers/galleryController.js b/controllers/galleryController.js
index 39826dd..4fd7c49 100644
--- a/controllers/galleryController.js
+++ b/controllers/galleryController.js
@@ -5,8 +5,8 @@ let galleryController = {}
galleryController.list = function(req, res, next){
- if(config.TOKEN !== '')
- if(req.headers.auth !== config.TOKEN)
+ if(config.TOKEN === true)
+ if(req.headers.auth === config.clientToken)
return res.status(401).send('not-authorized')
db.table('gallery').select('id', 'name').then((data) => {
@@ -16,8 +16,8 @@ galleryController.list = function(req, res, next){
galleryController.test = function(req, res, next){
- if(config.TOKEN !== '')
- if(req.headers.auth !== config.TOKEN)
+ if(config.TOKEN === true)
+ if(req.headers.auth === config.clientToken)
return res.status(401).send('not-authorized')
let testdata = [
diff --git a/controllers/uploadController.js b/controllers/uploadController.js
index 090181a..5afcc29 100644
--- a/controllers/uploadController.js
+++ b/controllers/uploadController.js
@@ -22,8 +22,8 @@ const upload = multer({
uploadsController.upload = function(req, res, next){
- if(config.TOKEN !== '')
- if(req.headers.auth !== config.TOKEN)
+ if(config.TOKEN === true)
+ if(req.headers.auth !== config.clientToken)
return res.status(401).send('not-authorized')
let gallery = req.headers.gallery
@@ -63,8 +63,8 @@ uploadsController.upload = function(req, res, next){
uploadsController.list = function(req, res){
- if(config.TOKEN !== '')
- if(req.headers.auth !== config.TOKEN)
+ if(config.TOKEN === true)
+ if(req.headers.auth !== config.clientToken)
return res.status(401).send('not-authorized')
db.table('files').then((files) => {