From a6fa8da93a13a1b895751c72aea5b310cf35b505 Mon Sep 17 00:00:00 2001 From: Rosanny <rosanny.sihombing@hft-stuttgart.de> Date: Wed, 4 Mar 2020 14:50:32 +0100 Subject: [PATCH] add route for project-list --- routes/routes.js | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/routes/routes.js b/routes/routes.js index 09d5fe6b..481e2fb9 100644 --- a/routes/routes.js +++ b/routes/routes.js @@ -114,12 +114,12 @@ module.exports = function (app, config, passport, i18n) { var lang = 'DE' - // ======== APP ROUTES ==================== + // ======== APP ROUTES - ACCOUNT ==================== app.get('/', function (req, res) { if (req.isAuthenticated()) { methods.getUserByEmail(req.user.email, function(data, err){ if (!err) { - res.render(lang+'/home', { + res.render(lang+'/account/home', { user: data }); } @@ -167,7 +167,7 @@ module.exports = function (app, config, passport, i18n) { if (req.isAuthenticated()) { methods.getUserByEmail(req.user.email, function(data, err){ if (!err) { - res.render(lang+'/profile', { + res.render(lang+'/account/profile', { user: data, email: req.user.email }); @@ -231,7 +231,7 @@ module.exports = function (app, config, passport, i18n) { } // render the page - res.render(lang+'/services', { + res.render(lang+'/account/services', { user: req.user, project: allProjects }); @@ -244,7 +244,7 @@ module.exports = function (app, config, passport, i18n) { app.get('/security', function (req, res) { if (req.isAuthenticated()) { - res.render(lang+'/security', { + res.render(lang+'/account/security', { user: req.user // useful for view engine, useless for HTML }); } else { @@ -362,7 +362,7 @@ module.exports = function (app, config, passport, i18n) { }); app.get('/forgotPwd', function (req, res) { - res.render(lang+'/forgotPwd', { + res.render(lang+'/account/forgotPwd', { user: req.user }); }); @@ -446,7 +446,7 @@ module.exports = function (app, config, passport, i18n) { res.redirect('/forgotPwd'); // localhost } else { - res.render(lang+'/reset'); + res.render(lang+'/account/reset'); } }); }); @@ -498,7 +498,7 @@ module.exports = function (app, config, passport, i18n) { // todo: user registration with captcha app.get('/registration', function(req, res) { - res.render(lang+'/registration') + res.render(lang+'/account/registration') }) app.post('/registration', function(req, res) { @@ -543,7 +543,6 @@ module.exports = function (app, config, passport, i18n) { }); }) - app.get('/email/:email', function(req, res) { methods.checkUserEmail(req.params.email, function(err, user){ if (!err) { @@ -557,4 +556,20 @@ module.exports = function (app, config, passport, i18n) { }) }) + // ======== APP ROUTES - PROJECT LIST ==================== + app.get('/project', function (req, res) { + if (req.isAuthenticated()) { + console.log("true") + res.render(lang+'/projectList/projects', { + isUserAuthenticated: true + }); + } + else { + console.log("false") + res.render(lang+'/projectList/projects', { + isUserAuthenticated: false + }); + } + }) + }; -- GitLab