aboutsummaryrefslogtreecommitdiff
path: root/controllers
diff options
context:
space:
mode:
authorMateja <mail@matejamaric.com>2021-05-06 22:22:27 +0200
committerMateja <mail@matejamaric.com>2021-05-06 22:22:27 +0200
commit3237737dc88ebff88c258972ac902f9221a003b5 (patch)
tree8c251c067465f8acfd641759268ee4d4d6ddf790 /controllers
parent143755e5e8a53eeee9f5b2fa7e3b76866c9673d7 (diff)
downloadnode-playground-3237737dc88ebff88c258972ac902f9221a003b5.tar.gz
node-playground-3237737dc88ebff88c258972ac902f9221a003b5.zip
Hash passwords.
Diffstat (limited to 'controllers')
-rw-r--r--controllers/user.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/controllers/user.js b/controllers/user.js
index 54b8161..980fc12 100644
--- a/controllers/user.js
+++ b/controllers/user.js
@@ -1,4 +1,5 @@
const User = require('../models/user');
+const bcrypt = require('bcryptjs');
module.exports = {
@@ -8,7 +9,7 @@ module.exports = {
firstname: req.body.firstname,
lastname: req.body.lastname,
email: req.body.email,
- password: req.body.password
+ password: bcrypt.hashSync(req.body.password)
});
newUser.save().then(() => {
req.flash('msg', 'You successfully registered.');