Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self.createUser = function(username, password, email, callback) {
bcrypt.encrypt(password, salt, function(err, hash){
db.save({
type:"user",
username: username,
password: hash,
email: email
},
callback);
});
};
bcrypt.gen_salt(workFactor, function(err, salt) {
if (err) callback(err);
bcrypt.encrypt(password, salt, function(err, hashedPassword) {
if (err) callback(err);
callback(null, hashedPassword);
});
});
}
bcrypt.gen_salt(12, function (err, salt) {
bcrypt.encrypt(form.data.password, salt, function (err, hash) {
db.run('INSERT INTO user (username, password_hash) values (?, ?)',
form.data.username, hash, function (err) {
req.flash('info', 'Account created. Login to continue.');
res.redirect('/login');
});
});
});
},
bcrypt.gen_salt(10, function(err, salt) {
bcrypt.encrypt(password, salt, function(err, hash) {
if (err) {
callback(new Error('Failed to encrypt password.'));
}
else {
user.password = hash;
callback(null, user);
}
});
});
};