mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
fix(console) authCheck called once
This commit is contained in:
parent
cec53f5de5
commit
0e0d1e2973
1 changed files with 17 additions and 13 deletions
|
|
@ -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, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue