From 143894288a3a7798ca98828e704dcc9c247ca429 Mon Sep 17 00:00:00 2001 From: MrFry Date: Wed, 8 Apr 2020 18:09:56 +0200 Subject: [PATCH] Added auth middleware to dataeditor, bg color change on some places --- modules/dataEditor/dataEditor.js | 39 +++++++++++++++++++---------- modules/qmining/views/veteranPw.ejs | 7 ++++-- sharedViews/login.ejs | 7 ++++-- 3 files changed, 36 insertions(+), 17 deletions(-) diff --git a/modules/dataEditor/dataEditor.js b/modules/dataEditor/dataEditor.js index 575c661..95527b7 100644 --- a/modules/dataEditor/dataEditor.js +++ b/modules/dataEditor/dataEditor.js @@ -25,21 +25,11 @@ const app = express() const utils = require('../../utils/utils.js') const logger = require('../../utils/logger.js') +const auth = require('../../middlewares/auth.middleware.js') + +let userDB function GetApp () { - app.set('view engine', 'ejs') - app.set('views', [ - './modules/dataEditor/views', - './sharedViews' - ]) - app.use(express.static('modules/dataEditor/public')) - app.use(express.static('public')) - app.use(busboy({ - limits: { - fileSize: 10000 * 1024 * 1024 - } - })) - app.use(bodyParser.json()) app.use(bodyParser.urlencoded({ limit: '5mb', extended: true @@ -47,6 +37,26 @@ function GetApp () { app.use(bodyParser.json({ limit: '5mb' })) + app.set('view engine', 'ejs') + app.set('views', [ + './modules/dataEditor/views', + './sharedViews' + ]) + app.use(auth({ + userDB: userDB, + jsonResponse: false, + exceptions: [ + '/favicon.ico', + '/getVeteranPw' + ] + })) + app.use(express.static('modules/dataEditor/public')) + app.use(express.static('public')) + app.use(busboy({ + limits: { + fileSize: 10000 * 1024 * 1024 + } + })) // -------------------------------------------------------------- @@ -91,3 +101,6 @@ function GetApp () { exports.name = 'Data editor' exports.getApp = GetApp +exports.setup = (data) => { + userDB = data.userDB +} diff --git a/modules/qmining/views/veteranPw.ejs b/modules/qmining/views/veteranPw.ejs index af891d4..eabb2cd 100644 --- a/modules/qmining/views/veteranPw.ejs +++ b/modules/qmining/views/veteranPw.ejs @@ -1,6 +1,6 @@ - + Frylabs @@ -40,11 +40,14 @@ cursor: pointer; } input[type=text], input[type=password] { + font-size: 20px; + color: #ffffff; + background-color: #181a1b; width: 100%; padding: 12px 20px; margin: 8px 0; box-sizing: border-box; - border: 2px solid #fff; + border: 2px solid #333333; text-align: center; } input[type=text], input[type=password]:focus { diff --git a/sharedViews/login.ejs b/sharedViews/login.ejs index 292bbf8..10bd79b 100644 --- a/sharedViews/login.ejs +++ b/sharedViews/login.ejs @@ -1,5 +1,5 @@ - + Frylabs @@ -40,11 +40,14 @@ cursor: pointer; } input[type=text], input[type=password] { + font-size: 20px; + color: #ffffff; + background-color: #181a1b; width: 100%; padding: 12px 20px; margin: 8px 0; box-sizing: border-box; - border: 2px solid #fff; + border: 2px solid #333333; text-align: center; } input[type=text], input[type=password]:focus {