refactor(konsole) create spawn: on auth always -> on auth, only when auth enabled

This commit is contained in:
coderaiser 2015-09-30 03:42:23 -04:00
parent 8c1f3ad99e
commit e9f5d257f1

View file

@ -51,16 +51,17 @@
var prefix = getPrefix();
Console(Element, prefix, function(spawn) {
spawn.on('auth', function() {
Dialog.alert(TITLE, 'Wrong credentials!');
});
DOM.Files.get('config', function(error, config) {
if (error)
return Dialog.alert(TITLE, error);
if (config.auth)
if (config.auth) {
spawn.emit('auth', config.username, config.password);
spawn.on('auth', function() {
Dialog.alert(TITLE, 'Wrong credentials!');
});
}
});
Util.exec(callback);