From f8044bfc966a45ceeb8094bb5e8eb35c3dc9913f Mon Sep 17 00:00:00 2001 From: Daniel Date: Sun, 12 Jun 2016 07:43:35 +0100 Subject: [PATCH] Remove redundant variables (#397) --- src/clientManager.js | 4 +--- src/command-line/reset.js | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/clientManager.js b/src/clientManager.js index 3481be54..fefef2a6 100644 --- a/src/clientManager.js +++ b/src/clientManager.js @@ -122,10 +122,8 @@ ClientManager.prototype.readUserConfig = function(name) { if (users.indexOf(name) === -1) { return false; } - var user = {}; var data = fs.readFileSync(Helper.getUserConfigPath(name), "utf-8"); - user = JSON.parse(data); - return user; + return JSON.parse(data); }; ClientManager.prototype.removeUser = function(name) { diff --git a/src/command-line/reset.js b/src/command-line/reset.js index 38449fa4..d337c809 100644 --- a/src/command-line/reset.js +++ b/src/command-line/reset.js @@ -22,9 +22,7 @@ program if (err) { return; } - var salt = bcrypt.genSaltSync(8); - var hash = bcrypt.hashSync(password, salt); - user.password = hash; + user.password = bcrypt.hashSync(password, bcrypt.genSaltSync(8)); fs.writeFileSync( file, JSON.stringify(user, null, " ")