mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-24 21:12:38 -04:00
28 lines
432 B
JavaScript
28 lines
432 B
JavaScript
|
function setSource(source) {
|
||
|
return function (req, res, next) {
|
||
|
if (req.session) {
|
||
|
req.session.required_login_for = source
|
||
|
}
|
||
|
next()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function clearSource() {
|
||
|
return function (req, res, next) {
|
||
|
doClearSource(req.session)
|
||
|
next()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
function doClearSource(session) {
|
||
|
if (session) {
|
||
|
delete session.required_login_for
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports = {
|
||
|
setSource,
|
||
|
clearSource,
|
||
|
doClearSource,
|
||
|
}
|