fix(console) authCheck called once

This commit is contained in:
coderaiser 2015-10-14 13:22:45 -04:00
parent cec53f5de5
commit 0e0d1e2973

View file

@ -16,6 +16,7 @@
Loaded,
Images = DOM.Images,
Dialog = DOM.Dialog,
exec = Util.exec,
Konsole = this;
@ -51,19 +52,7 @@
var prefix = getPrefix();
Console(Element, prefix, function(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!');
});
}
});
spawn.on('connect', exec.with(authCheck, spawn));
Util.exec(callback);
});
@ -78,6 +67,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!');
});
}
});
}
this.show = function(callback) {
if (Loaded)
CloudCmd.View.show(Element, {