From 6794bee60468c31c88af30eacf3b8b43ed0ee430 Mon Sep 17 00:00:00 2001 From: Bryan Ashby Date: Sun, 3 Jan 2016 16:04:37 -0700 Subject: [PATCH] Fix userId bug --- oputil.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/oputil.js b/oputil.js index 1faaf88d..c1aa2450 100644 --- a/oputil.js +++ b/oputil.js @@ -7,6 +7,7 @@ var db = require('./core/database.js'); var _ = require('lodash'); var async = require('async'); +var assert = require('assert'); var argv = require('minimist')(process.argv.slice(2)); @@ -72,7 +73,7 @@ function handleUserCommand() { }, function getUser(callback) { user = require('./core/user.js'); - user.getUserIdAndName(argv.user, function userNameAndId(err, username, userId) { + user.getUserIdAndName(argv.user, function userNameAndId(err, userId) { if(err) { process.exitCode = ExitCodes.BAD_ARGS; callback(new Error('Failed to retrieve user')); @@ -82,8 +83,12 @@ function handleUserCommand() { }); }, function setNewPass(userId, callback) { + assert(_.isNumber(userId)); + assert(userId > 0); + var u = new user.User(); u.userId = userId; + u.setNewAuthCredentials(argv.password, function credsSet(err) { if(err) { process.exitCode = ExitCodes.ERROR;