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

22
data/seeds/01-addUsers.js Normal file
View File

@@ -0,0 +1,22 @@
require("dotenv").config();
const bcrypt = require('bcryptjs');
exports.seed = function(knex) {
return knex('users').truncate()
.then(function () {
return knex('users').insert([
{
id: 1,
email: 'gabe@ls.com',
username: 'gabe',
password: bcrypt.hashSync('1234', process.env.SECRET, 10)
},
{
id: 2,
email: 'gabe2@ls.com',
username: 'gabe2',
password: bcrypt.hashSync('1234', process.env.SECRET, 10)
}
]);
});
};

View File

@@ -1,19 +0,0 @@
exports.seed = function(knex) {
return knex('users').truncate()
.then(function () {
return knex('users').insert([
// {
// id: 1,
// email: 'gabe@ls.com',
// username: 'gabe',
// password: '1234'
// },
// {
// id: 2,
// email: 'gabe2@ls.com',
// username: 'gabe2',
// password: '1234'
// }
]);
});
};

Binary file not shown.