Update seed and authentication with salt

This commit is contained in:
2019-08-01 17:42:18 +02:00
parent 03a9c793d8
commit 165d376294
5 changed files with 36 additions and 32 deletions

View File

@@ -1,3 +1,4 @@
require("dotenv").config();
const router = require('express').Router();
const bcrypt = require('bcryptjs');
@@ -6,7 +7,7 @@ const Users = require('../users/usersModel');
router.post('/register', (req, res) => {
let user = req.body;
const hash = bcrypt.hashSync(user.password, 10);
const hash = bcrypt.hashSync(user.password, process.env.SECRET, 10);
user.password = hash;
Users.addUser(user)