www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | Submodules | README | LICENSE

commit 6139f7045ecfc64bd43232377c864ccf3c9fac77
parent dc0bb68f0465287eaeaf0774692196db535c1f25
Author: Dan Stillman <dstillman@zotero.org>
Date:   Wed, 21 Sep 2016 00:46:28 -0400

Fix automatic syncing when no legacy password

Diffstat:
Mchrome/content/zotero/xpcom/sync/syncLocal.js | 14++++++++++++++
Mchrome/content/zotero/xpcom/sync/syncRunner.js | 4+---
2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/chrome/content/zotero/xpcom/sync/syncLocal.js b/chrome/content/zotero/xpcom/sync/syncLocal.js @@ -54,6 +54,20 @@ Zotero.Sync.Data.Local = { }), + /** + * Check for an API key or a legacy username/password (which may or may not be valid) + */ + hasCredentials: function () { + var login = this._getAPIKeyLoginInfo(); + if (login) { + return true; + } + // If no API key, check for legacy login + var username = Zotero.Prefs.get('sync.server.username'); + return username && !!this.getLegacyPassword(username) + }, + + setAPIKey: function (apiKey) { var loginManager = Components.classes["@mozilla.org/login-manager;1"] .getService(Components.interfaces.nsILoginManager); diff --git a/chrome/content/zotero/xpcom/sync/syncRunner.js b/chrome/content/zotero/xpcom/sync/syncRunner.js @@ -35,9 +35,7 @@ Zotero.Sync.Runner_Module = function (options = {}) { Zotero.defineProperty(this, 'enabled', { get: () => { - if (_apiKey) return true; - var username = Zotero.Prefs.get('sync.server.username'); - return username && Zotero.Sync.Data.Local.getLegacyPassword(username); + return _apiKey || Zotero.Sync.Data.Local.hasCredentials(); } }); Zotero.defineProperty(this, 'syncInProgress', { get: () => _syncInProgress });