Fix automatic syncing when no legacy password
This commit is contained in:
parent
dc0bb68f04
commit
6139f7045e
2 changed files with 15 additions and 3 deletions
|
@ -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);
|
||||
|
|
|
@ -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 });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue