18 lines
437 B
JavaScript
18 lines
437 B
JavaScript
|
const Middleware = require('libflitter/middleware/Middleware')
|
||
|
class DMZOnly extends Middleware {
|
||
|
|
||
|
async test(req, res, next, args = {}){
|
||
|
|
||
|
if ( req.is_auth ) return next()
|
||
|
else {
|
||
|
// If not signed in, save the target url so we can redirect back here after auth
|
||
|
req.session.auth.flow = req.originalUrl
|
||
|
return res.redirect('/auth/login')
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
module.exports = DMZOnly
|