Adds bcrypt native binding for better login performance (#2549)
* Adds bcrypt native binding for better login performance * Swaps bcrypt-nodejs for bcryptjs as compatible with bcrypt native * Fixes package versions
This commit is contained in:
@@ -1,11 +1,15 @@
|
||||
// Tools for encrypting and decrypting passwords.
|
||||
// Basically promise-friendly wrappers for bcrypt.
|
||||
var bcrypt = require('bcrypt-nodejs');
|
||||
var bcrypt = require('bcryptjs');
|
||||
|
||||
try {
|
||||
bcrypt = require('bcrypt');
|
||||
} catch(e) {}
|
||||
|
||||
// Returns a promise for a hashed password string.
|
||||
function hash(password) {
|
||||
return new Promise(function(fulfill, reject) {
|
||||
bcrypt.hash(password, null, null, function(err, hashedPassword) {
|
||||
bcrypt.hash(password, 10, function(err, hashedPassword) {
|
||||
if (err) {
|
||||
reject(err);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user