2019-06-24 16:45:22 +00:00
|
|
|
/*
|
|
|
|
* Invite Middleware
|
|
|
|
* -------------------------------------------------------------
|
|
|
|
* Put some description here!
|
|
|
|
*/
|
2019-08-16 14:58:21 +00:00
|
|
|
const Middleware = require('libflitter/middleware/Middleware')
|
|
|
|
class Invite extends Middleware {
|
2019-06-24 16:45:22 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
2019-08-16 14:58:21 +00:00
|
|
|
test(req, res, next, args = {}) {
|
|
|
|
if (req.session.invite && !req.originalUrl.includes('/dash/v1/invitation/accept')) {
|
2019-06-24 16:45:22 +00:00
|
|
|
return res.redirect('/dash/v1/invitation/accept')
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Call the next function in the stack.
|
|
|
|
*/
|
|
|
|
next()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Invite
|