add link sharing
This commit is contained in:
@@ -9,10 +9,10 @@
|
||||
* Route-specific middleware should be specified in the corresponding
|
||||
* routes file.
|
||||
*/
|
||||
const Middleware = [
|
||||
|
||||
'Debug',
|
||||
let Middleware = [
|
||||
|
||||
]
|
||||
|
||||
if ( _flitter.config('server.environment') === 'development' ) Middleware.push('Debug')
|
||||
|
||||
module.exports = exports = Middleware
|
||||
|
||||
26
app/routing/middleware/v1/Invite.middleware.js
Normal file
26
app/routing/middleware/v1/Invite.middleware.js
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Invite Middleware
|
||||
* -------------------------------------------------------------
|
||||
* Put some description here!
|
||||
*/
|
||||
class Invite {
|
||||
|
||||
/*
|
||||
* 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
|
||||
@@ -34,6 +34,8 @@ const v1 = {
|
||||
*/
|
||||
get: {
|
||||
// '/': [ controller('Controller_Name').handler_name ],
|
||||
'/invitation/:id': [ _flitter.controller('api:v1').invite_show ],
|
||||
'/invitation/:id/accept': [ _flitter.controller('api:v1').invite_accept ],
|
||||
},
|
||||
|
||||
/*
|
||||
|
||||
@@ -21,7 +21,8 @@ const v1 = {
|
||||
*/
|
||||
middleware: [
|
||||
// mw('Middleware Name'),
|
||||
_flitter.mw('auth:RequireAuth')
|
||||
_flitter.mw('auth:RequireAuth'),
|
||||
_flitter.mw('v1:Invite')
|
||||
],
|
||||
|
||||
/*
|
||||
@@ -44,11 +45,14 @@ const v1 = {
|
||||
'/project/share/:id/share/:user': [ _flitter.controller('dash:v1').project_share_do ],
|
||||
'/project/share/:id/revoke/:user': [ _flitter.controller('dash:v1').project_share_revoke ],
|
||||
'/project/share/:id/transfer/:user': [ _flitter.controller('dash:v1').project_share_transfer ],
|
||||
'/project/share/:id/invite': [ _flitter.controller('dash:v1').project_share_invite ],
|
||||
|
||||
'/out/view/:id': [ _flitter.controller('dash:v1').out_view ],
|
||||
'/out/delete/:id/:project': [ _flitter.controller('dash:v1').out_delete ],
|
||||
|
||||
'/code': [ _flitter.controller('dash:v1').view_code ],
|
||||
|
||||
'/invitation/accept': [ _flitter.controller('dash:v1').accept_invite ],
|
||||
},
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user