mirror of
https://gitlab.com/MrFry/mrfrys-node-server
synced 2025-04-01 20:24:18 +02:00
Added exceptions to auth middleware, basic redirects
This commit is contained in:
parent
feb9eab5ad
commit
840f64c66b
3 changed files with 33 additions and 15 deletions
|
@ -88,13 +88,19 @@ app.use(session({
|
|||
saveUninitialized: true
|
||||
}))
|
||||
app.use(cookieParser())
|
||||
app.use(bodyParser.urlencoded({
|
||||
limit: '10mb',
|
||||
extended: true
|
||||
}))
|
||||
app.use(bodyParser.json({
|
||||
limit: '10mb'
|
||||
}))
|
||||
app.set('view engine', 'ejs')
|
||||
app.set('views', [
|
||||
'./modules/api/views',
|
||||
'./sharedViews'
|
||||
])
|
||||
app.use(auth({
|
||||
debugLog: true,
|
||||
authDB: authDB
|
||||
}))
|
||||
app.use(express.static('public'))
|
||||
|
@ -103,13 +109,6 @@ app.use(busboy({
|
|||
fileSize: 50000 * 1024 * 1024
|
||||
}
|
||||
}))
|
||||
app.use(bodyParser.urlencoded({
|
||||
limit: '10mb',
|
||||
extended: true
|
||||
}))
|
||||
app.use(bodyParser.json({
|
||||
limit: '10mb'
|
||||
}))
|
||||
|
||||
var data = actions.LoadJSON(dataFile)
|
||||
var version = ''
|
||||
|
@ -143,12 +142,12 @@ Load()
|
|||
|
||||
app.post('/login', (req, res) => {
|
||||
logger.LogReq(req)
|
||||
console.log(req.body)
|
||||
const pw = req.body.pw
|
||||
// FIXME: redirect to original url
|
||||
const user = 'u'
|
||||
// TODO: get user
|
||||
// TODO: check if pw is correct
|
||||
res.cookie('pw', req.query.pw).redirect('/')
|
||||
res.cookie('pw', pw).redirect('/')
|
||||
req.session.user = user
|
||||
})
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue