You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
devbug/app/routing/middleware/v1/Invite.middleware.js

27 lines
762 B

/*
* Invite Middleware
* -------------------------------------------------------------
* Put some description here!
*/
const Middleware = require('libflitter/middleware/Middleware')
class Invite extends Middleware {
/*
* Run the middleware test.
* This method is required by all Flitter middleware.
* It should either call the next function in the stack,
* or it should handle the response accordingly.
*/
test(req, res, next, args = {}) {
if (req.session.invite && !req.originalUrl.includes('/dash/v1/invitation/accept')) {
return res.redirect('/dash/v1/invitation/accept')
}
/*
* Call the next function in the stack.
*/
next()
}
}
module.exports = Invite