1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

add bcrypt as optional dependency to speed up Pi,

but not force compile on Windows.
Fix to close Issue #585
This commit is contained in:
dceejay 2015-03-19 11:36:48 +00:00
parent 2d91be8814
commit a9789697e7
2 changed files with 7 additions and 4 deletions

View File

@ -59,6 +59,9 @@
"passport-oauth2-client-password":"0.1.2",
"oauth2orize":"1.0.1"
},
"optionalDependencies": {
"bcrypt":"0.8.1"
},
"devDependencies": {
"grunt": "0.4.5",
"grunt-cli": "0.1.13",

View File

@ -16,8 +16,9 @@
var when = require("when");
var util = require("util");
var bcrypt = require('bcryptjs');
var bcrypt;
try { bcrypt = require('bcrypt'); }
catch(e) { bcrypt = require('bcryptjs'); }
var users = {};
var passwords = {};
var defaultUser = null;
@ -56,6 +57,7 @@ function init(config) {
api.get = config.users;
} else {
var us = config.users;
/* istanbul ignore else */
if (!util.isArray(us)) {
us = [us];
}
@ -97,5 +99,3 @@ module.exports = {
authenticate: function(username,password) { return api.authenticate(username,password) },
default: function() { return api.default(); }
};