mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
12 lines
416 B
CoffeeScript
12 lines
416 B
CoffeeScript
User = require("../../models/User").User
|
|
AuthenticationController = require('../Authentication/AuthenticationController')
|
|
|
|
module.exports = RefererMiddleware =
|
|
getUserReferalId: (req, res, next) ->
|
|
if AuthenticationController.isUserLoggedIn()?
|
|
AuthenticationController.getLoggedInUser req, (error, user) ->
|
|
return next(error) if error?
|
|
req.user.referal_id = user.referal_id
|
|
next()
|
|
else
|
|
next()
|