From e32c0fccec7f976b6cfea8367edc97049d52b378 Mon Sep 17 00:00:00 2001 From: Wolfgang Knopki <wolfgang.knopki@hft-stuttgart.de> Date: Tue, 10 Dec 2019 14:05:21 +0100 Subject: [PATCH] change of header if email is valid --- public/js/account.js | 6 ++++++ routes/routes.js | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/public/js/account.js b/public/js/account.js index 59d74ae8..2b109c6c 100644 --- a/public/js/account.js +++ b/public/js/account.js @@ -23,6 +23,12 @@ $.get( "/api/v1/profile", function(data) { $("#inputIndustry").val(industry); $("#inputOrganisation").val(organisation); $("#inputSpeciality").val(speciality); + + // check for valid email and then change header accordingly: + if(email != ''){ + document.getElementById("navbarDropdown4").innerHTML="Logout"; + document.getElementById("navbarDropdown4").href="/account/logout"; + } }) .done(function() { console.log("done"); diff --git a/routes/routes.js b/routes/routes.js index e849589e..17ce02fb 100644 --- a/routes/routes.js +++ b/routes/routes.js @@ -88,7 +88,7 @@ module.exports = function (app, config, passport) { ); app.get('/profile', function (req, res) { - if (req.isAuthenticated()) { + if (req.isAuthenticated()) { res.render('profile', { user: req.user // useful for view engine, useless for HTML }); -- GitLab