mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-07-20 18:18:56 +00:00
feature(edit) add authCheck
This commit is contained in:
parent
1dc7698746
commit
32a59c0c26
1 changed files with 22 additions and 1 deletions
|
|
@ -49,11 +49,17 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format;
|
|||
function(callback) {
|
||||
loadFiles(element, callback);
|
||||
},
|
||||
function(callback) {
|
||||
authCheck(editor);
|
||||
callback();
|
||||
},
|
||||
function(callback) {
|
||||
Edit.create(element)
|
||||
.show(callback);
|
||||
|
||||
}, callback]);
|
||||
},
|
||||
callback
|
||||
]);
|
||||
}
|
||||
|
||||
function createElement() {
|
||||
|
|
@ -119,6 +125,21 @@ var CloudCmd, Util, DOM, CloudFunc, MenuIO, Format;
|
|||
return this;
|
||||
};
|
||||
|
||||
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 getConfig(callback) {
|
||||
DOM.Files.get('config', function(error, config) {
|
||||
if (error)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue