2017-07-08 13:48:34 +00:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const passport = require('./passport');
|
2017-07-08 18:32:04 +00:00
|
|
|
const config = require('config');
|
2017-07-08 13:48:34 +00:00
|
|
|
|
|
|
|
function _getConfig() {
|
|
|
|
return {
|
|
|
|
authMethod: passport.authMethod,
|
2017-07-08 18:32:04 +00:00
|
|
|
isAuthMethodLocal: passport.isAuthMethodLocal,
|
|
|
|
externalPasswordResetLink: config.ldap.passwordresetlink
|
2017-07-08 13:48:34 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function registerRootRoute(router, title, entryPoint) {
|
|
|
|
router.get('/*', passport.csrfProtection, (req, res) => {
|
|
|
|
res.render('react-root', {
|
|
|
|
title,
|
|
|
|
reactEntryPoint: entryPoint,
|
|
|
|
reactCsrfToken: req.csrfToken(),
|
|
|
|
mailtrainConfig: JSON.stringify(_getConfig())
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
registerRootRoute
|
|
|
|
};
|
|
|
|
|