mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 10:45:47 +00:00
refactor(dropbox) login
This commit is contained in:
parent
8d968700ae
commit
4ea80a38cd
1 changed files with 9 additions and 7 deletions
|
|
@ -64,20 +64,22 @@ var CloudCmd, Util, DOM, CloudFunc, Dropbox, cb, Client;
|
|||
* @param pData = {key, secret}
|
||||
*/
|
||||
this.login = function(callback) {
|
||||
CloudCmd.getModules(function(pModules){
|
||||
var lStorage = Util.findObjByNameInArr(pModules, 'storage'),
|
||||
lDropBox = Util.findObjByNameInArr(lStorage, 'DropBox'),
|
||||
lDropBoxKey = lDropBox && lDropBox.key;
|
||||
CloudCmd.getModules(function(modules){
|
||||
var url = CloudCmd.HOST + '/html/auth/dropbox.html',
|
||||
storage = Util.findObjByNameInArr(modules, 'storage'),
|
||||
dropbox = Util.findObjByNameInArr(storage, 'DropBox'),
|
||||
key = dropbox.key;
|
||||
|
||||
Client = new Dropbox.Client({
|
||||
key: lDropBoxKey
|
||||
key: key
|
||||
});
|
||||
|
||||
//Client.authDriver(new Dropbox.Drivers.Redirect({rememberUser: true}));
|
||||
|
||||
var lURL = CloudCmd.HOST + '/html/auth/dropbox.html';
|
||||
|
||||
Client.authDriver(new Dropbox.AuthDriver.Popup({
|
||||
receiverUrl: lURL, noFragment: true
|
||||
receiverUrl : url,
|
||||
noFragment : true
|
||||
}));
|
||||
|
||||
Client.authenticate(function(error, client) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue