diff --git a/lib/client/operation.js b/lib/client/operation.js index 9c4fa245..db97b14a 100644 --- a/lib/client/operation.js +++ b/lib/client/operation.js @@ -59,6 +59,21 @@ ]); } + function authCheck(spawn) { + DOM.Files.get('config', function(error, config) { + if (error) + return Dialog.alert(TITLE, error); + + if (config.auth) { + spawn.emit('auth', config.username, config.password); + + spawn.on('auth', function() { + Dialog.alert(TITLE, 'Wrong credentials!'); + }); + } + }); + } + function create(prefix, callback) { exec.series([ function(fn) { @@ -66,6 +81,7 @@ fn(); copier.on('connect', function() { + authCheck(copier); copyFn = function(data, callback) { setListeners(copier, callback); copier.copy(data.from, data.to, data.names); @@ -82,6 +98,7 @@ remedy(prefix + '/remedy', prefix, function(remover) { fn(); remover.on('connect', function() { + authCheck(remover); deleteFn = function(from, files, callback) { from = from.replace(/\?.*/, ''); @@ -100,6 +117,7 @@ ishtar(prefix + '/ishtar', prefix, function(packer) { fn(); packer.on('connect', function() { + authCheck(packer); packFn = function(data, callback) { setListeners(packer, callback);