diff options
author | Mateja <mail@matejamaric.com> | 2021-05-07 00:27:51 +0200 |
---|---|---|
committer | Mateja <mail@matejamaric.com> | 2021-05-07 00:27:51 +0200 |
commit | 5f58ad7e7b7546077556abd70fca44b296bb0c0c (patch) | |
tree | 62d9185304bfd8e15a8d5d2c6ecf221ed7f6d921 /controllers | |
parent | d7e364d83153425e412032dd997e9c58cbc235eb (diff) | |
download | node-playground-5f58ad7e7b7546077556abd70fca44b296bb0c0c.tar.gz node-playground-5f58ad7e7b7546077556abd70fca44b296bb0c0c.zip |
Auto login on user registration.
Diffstat (limited to 'controllers')
-rw-r--r-- | controllers/user.js | 3 |
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 { |