aboutsummaryrefslogtreecommitdiff
path: root/controllers
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2021-05-07 01:16:03 +0200
committerMateja <mail@matejamaric.com>2021-05-07 01:16:03 +0200
commitb99ff3787373aec8b0d679f301609361d39362e4 (patch)
treedc1846939632dc53c4836f8a609182bc2dff5a23 /controllers
parent5f58ad7e7b7546077556abd70fca44b296bb0c0c (diff)
downloadnode-playground-b99ff3787373aec8b0d679f301609361d39362e4.tar.gz
node-playground-b99ff3787373aec8b0d679f301609361d39362e4.zip
Change page layout if user is logged in.
Diffstat (limited to 'controllers')
-rw-r--r--controllers/post.js2
-rw-r--r--controllers/user.js2
2 files changed, 4 insertions, 0 deletions
diff --git a/controllers/post.js b/controllers/post.js
index d879fcc..09bbdec 100644
--- a/controllers/post.js
+++ b/controllers/post.js
@@ -6,6 +6,7 @@ module.exports = {
Post.find().lean().exec((err, posts) => {
res.render('home', {
title: 'Home Page',
+ auth: req.isAuthenticated(),
home: true,
posts: posts
});
@@ -15,6 +16,7 @@ module.exports = {
create(req, res) {
res.render('new-post', {
title: 'Make A New Post',
+ auth: req.isAuthenticated(),
newPost: true
});
},
diff --git a/controllers/user.js b/controllers/user.js
index 31afdfc..c64bfa0 100644
--- a/controllers/user.js
+++ b/controllers/user.js
@@ -29,6 +29,7 @@ module.exports = {
registerView(req, res) {
res.render('register', {
title: 'Register',
+ auth: req.isAuthenticated(),
register: true,
msg: req.flash('msg')
});
@@ -37,6 +38,7 @@ module.exports = {
loginView(req, res) {
res.render('login', {
title: 'Login',
+ auth: req.isAuthenticated(),
login: true,
msg: req.flash('msg')
});