aboutsummaryrefslogtreecommitdiff
path: root/controllers
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2021-05-07 00:27:51 +0200
committerMateja <mail@matejamaric.com>2021-05-07 00:27:51 +0200
commit5f58ad7e7b7546077556abd70fca44b296bb0c0c (patch)
tree62d9185304bfd8e15a8d5d2c6ecf221ed7f6d921 /controllers
parentd7e364d83153425e412032dd997e9c58cbc235eb (diff)
downloadnode-playground-5f58ad7e7b7546077556abd70fca44b296bb0c0c.tar.gz
node-playground-5f58ad7e7b7546077556abd70fca44b296bb0c0c.zip
Auto login on user registration.
Diffstat (limited to 'controllers')
-rw-r--r--controllers/user.js3
1 files changed, 1 insertions, 2 deletions
diff --git a/controllers/user.js b/controllers/user.js
index 3f7b4a1..31afdfc 100644
--- a/controllers/user.js
+++ b/controllers/user.js
@@ -12,8 +12,7 @@ module.exports = {
password: bcrypt.hashSync(req.body.password)
});
newUser.save().then(() => {
- req.flash('msg', 'You successfully registered.');
- res.redirect('/login');
+ req.login(newUser, () => res.redirect('/new-post'));
});
}
else {