diff --git a/src/controllers/index.js b/src/controllers/index.js index 7a9e0e786c..aaba36dcd6 100644 --- a/src/controllers/index.js +++ b/src/controllers/index.js @@ -237,4 +237,11 @@ Controllers.outgoing = function(req, res, next) { } }; +Controllers.termsOfUse = function(req, res, next) { + if (!meta.config.termsOfUse) { + return categoriesController.notFound(req, res); + } + res.render('tos', {termsOfUse: meta.config.termsOfUse}); +}; + module.exports = Controllers; diff --git a/src/routes/index.js b/src/routes/index.js index 395999507c..c538d2e4bf 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -3,9 +3,9 @@ var nconf = require('nconf'), path = require('path'), winston = require('winston'), - controllers = require('./../controllers'), - meta = require('./../meta'), - plugins = require('./../plugins'), + controllers = require('../controllers'), + meta = require('../meta'), + plugins = require('../plugins'), express = require('express'), metaRoutes = require('./meta'), @@ -28,6 +28,7 @@ function mainRoutes(app, middleware, controllers) { setupPageRoute(app, '/outgoing', middleware, [], controllers.outgoing); setupPageRoute(app, '/search/:term?', middleware, [middleware.guestSearchingAllowed], controllers.search); setupPageRoute(app, '/reset/:code?', middleware, [], controllers.reset); + setupPageRoute(app, '/tos', middleware, [], controllers.termsOfUse); } function staticRoutes(app, middleware, controllers) {