Repository: ignite Updated Branches: refs/heads/ignite-843 ce1559bc8 -> e2fc78ee0
IGNITE-843 Added check for not found account. Project: http://git-wip-us.apache.org/repos/asf/ignite/repo Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/ae9450dd Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/ae9450dd Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/ae9450dd Branch: refs/heads/ignite-843 Commit: ae9450dddf52d51d1c11d760c9a45c837dd87ed9 Parents: ce1559b Author: AKuznetsov <[email protected]> Authored: Sun Sep 6 22:51:43 2015 +0700 Committer: AKuznetsov <[email protected]> Committed: Sun Sep 6 22:51:43 2015 +0700 ---------------------------------------------------------------------- .../src/main/js/agents/agent-manager.js | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ignite/blob/ae9450dd/modules/control-center-web/src/main/js/agents/agent-manager.js ---------------------------------------------------------------------- diff --git a/modules/control-center-web/src/main/js/agents/agent-manager.js b/modules/control-center-web/src/main/js/agents/agent-manager.js index 2689be2..d37b629 100644 --- a/modules/control-center-web/src/main/js/agents/agent-manager.js +++ b/modules/control-center-web/src/main/js/agents/agent-manager.js @@ -121,19 +121,17 @@ function Client(ws, manager) { * @param {Function} [cb] Callback. Take 3 arguments: {String} error, {number} httpCode, {string} response. */ Client.prototype.executeRest = function(path, params, method, headers, body, cb) { - var self = this; - if (typeof(params) != 'object') - throw "'params' argument must be an object"; + throw '"params" argument must be an object'; if (typeof(cb) != 'function') - throw "callback must be a function"; + throw 'callback must be a function'; if (body && typeof(body) != 'string') - throw "body must be a string"; + throw 'body must be a string'; if (headers && typeof(headers) != 'object') - throw "headers must be an object"; + throw 'headers must be an object'; if (!method) method = 'GET'; @@ -141,7 +139,7 @@ Client.prototype.executeRest = function(path, params, method, headers, body, cb) method = method.toUpperCase(); if (method != 'GET' && method != 'POST') - throw "Unknown HTTP method: " + method; + throw 'Unknown HTTP method: ' + method; var newArgs = argsToArray(arguments); @@ -230,9 +228,12 @@ Client.prototype._invokeRmtMethod = function(methodName, args) { Client.prototype._rmtAuthMessage = function(msg) { var self = this; - var account = db.Account.findByUsername(msg.login, function(err, account) { + db.Account.findByUsername(msg.login, function(err, account) { if (err) { - self.authResult("User not found"); + self.authResult(err); + } + else if (!account) { + self.authResult('User not found'); } else { account.authenticate(msg.password, function(err, user, res) { @@ -303,7 +304,7 @@ var manager = null; exports.createManager = function(srv) { if (manager) - throw "Agent manager already cleared!"; + throw 'Agent manager already cleared!'; manager = new AgentManager(srv); };
