Use 'bcrypt-nodejs' package

This commit is contained in:
Mattias Erming 2014-10-03 02:57:35 -07:00
parent c4fad94513
commit 316fba3c08
4 changed files with 8 additions and 6 deletions

View File

@ -32,7 +32,7 @@
], ],
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"bcrypt": "^0.8.0", "bcrypt-nodejs": "0.0.3",
"cheerio": "^0.17.0", "cheerio": "^0.17.0",
"commander": "^2.3.0", "commander": "^2.3.0",
"express": "^4.9.5", "express": "^4.9.5",

View File

@ -1,5 +1,5 @@
var ClientManager = new require("../clientManager"); var ClientManager = new require("../clientManager");
var bcrypt = require("bcrypt"); var bcrypt = require("bcrypt-nodejs");
var fs = require("fs"); var fs = require("fs");
var program = require("commander"); var program = require("commander");
var mkdirp = require("mkdirp"); var mkdirp = require("mkdirp");
@ -52,7 +52,8 @@ program
function add(manager, name, password) { function add(manager, name, password) {
console.log(""); console.log("");
var hash = bcrypt.hashSync(password, 8); var salt = bcrypt.genSaltSync(8);
var hash = bcrypt.hashSync(password, salt);
manager.addUser( manager.addUser(
name, name,
hash hash

View File

@ -1,4 +1,4 @@
var bcrypt = require("bcrypt"); var bcrypt = require("bcrypt-nodejs");
var ClientManager = new require("../clientManager"); var ClientManager = new require("../clientManager");
var fs = require("fs"); var fs = require("fs");
var program = require("commander"); var program = require("commander");
@ -25,7 +25,8 @@ program
if (err) { if (err) {
return; return;
} }
var hash = bcrypt.hashSync(password, 8); var salt = bcrypt.genSaltSync(8);
var hash = bcrypt.hashSync(password, salt);
user.password = hash; user.password = hash;
fs.writeFileSync( fs.writeFileSync(
file, file,

View File

@ -1,5 +1,5 @@
var _ = require("lodash"); var _ = require("lodash");
var bcrypt = require("bcrypt"); var bcrypt = require("bcrypt-nodejs");
var Client = require("./client"); var Client = require("./client");
var ClientManager = require("./clientManager"); var ClientManager = require("./clientManager");
var express = require("express"); var express = require("express");