overleaf/services/web/app/coffee/Features/Referal/ReferalMiddleware.coffee

12 lines
369 B
CoffeeScript
Raw Normal View History

2014-02-12 05:23:40 -05:00
User = require("../../models/User").User
2016-09-05 10:58:31 -04:00
AuthenticationController = require('../Authentication/AuthenticationController')
2014-02-12 05:23:40 -05:00
module.exports = RefererMiddleware =
getUserReferalId: (req, res, next) ->
2016-09-07 11:40:49 -04:00
if AuthenticationController.isUserLoggedIn()
user = AuthenticationController.getSessionUser(req)
req.user.referal_id = user.referal_id
next()
2014-02-12 05:23:40 -05:00
else
next()