diff --git a/public/js/account.js b/public/js/account.js index 59d74ae82599be37ddc79c93ec28c794e7d8840f..2b109c6ca3ca6533dc90a03a413772f054045055 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 e849589e80b110592fe72751998777a1e70915cf..17ce02fbe9ffd52ecae1a2a9bb09e7b42592ac55 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 });