From 8a3075ee80ad659080b05b2cb00ea6003e64364e Mon Sep 17 00:00:00 2001 From: benweet Date: Wed, 25 Dec 2013 22:14:22 +0100 Subject: [PATCH] Secondary Google account (part5) --- public/res/helpers/googleHelper.js | 7 ++++--- public/res/providers/gdriveProviderBuilder.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/public/res/helpers/googleHelper.js b/public/res/helpers/googleHelper.js index c64888e5..de5c4599 100644 --- a/public/res/helpers/googleHelper.js +++ b/public/res/helpers/googleHelper.js @@ -153,9 +153,8 @@ define([ var immediate; function localAuthenticate() { if(authuser > 5) { - authuser = 0; - immediate = false; - eventMgr.onError('Unable to authenticate user ' + authorizationMgr.getUserId() + ', please use login form.'); + task.error(new Error('Unable to authenticate user ' + authorizationMgr.getUserId() + ', please sign in with Google.')); + return; } if(immediate === false) { task.timeout = constants.ASYNC_TASK_LONG_TIMEOUT; @@ -748,6 +747,7 @@ define([ var view; if(pickerType == 'doc') { view = new google.picker.DocsView(google.picker.ViewId.DOCS); + view.setParent('root'); view.setIncludeFolders(true); view.setMimeTypes([ "text/x-markdown", @@ -762,6 +762,7 @@ define([ } else if(pickerType == 'folder') { view = new google.picker.DocsView(google.picker.ViewId.FOLDERS); + view.setParent('root'); view.setIncludeFolders(true); view.setSelectFolderEnabled(true); view.setMimeTypes('application/vnd.google-apps.folder'); diff --git a/public/res/providers/gdriveProviderBuilder.js b/public/res/providers/gdriveProviderBuilder.js index ddc76298..928b15f9 100644 --- a/public/res/providers/gdriveProviderBuilder.js +++ b/public/res/providers/gdriveProviderBuilder.js @@ -508,7 +508,7 @@ define([ }); var state = utils.retrieveIgnoreError(providerId + ".state"); - if(state === undefined) { + if(state === undefined || state.userId != storage[accountId + '.userId']) { return; } storage.removeItem(providerId + ".state");