From 04496fadcd73ad7db85d7a9c662fcbffac80d72e Mon Sep 17 00:00:00 2001 From: abaevbog Date: Wed, 5 Jul 2023 04:11:56 -0400 Subject: [PATCH] only save username to prefs on successful login (#3192) Failing to login does not update the username in prefs. Fixes #2901 --- chrome/content/zotero/preferences/preferences_sync.jsx | 6 +++--- chrome/content/zotero/preferences/preferences_sync.xhtml | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/preferences/preferences_sync.jsx b/chrome/content/zotero/preferences/preferences_sync.jsx index 167d6df9c8..0314317ce8 100644 --- a/chrome/content/zotero/preferences/preferences_sync.jsx +++ b/chrome/content/zotero/preferences/preferences_sync.jsx @@ -125,8 +125,6 @@ Zotero_Preferences.Sync = { var trimmed = username.trim(); if (username != trimmed) { tb.value = trimmed; - // Setting .value alone doesn't seem to cause the pref to sync, so set it manually - Zotero.Prefs.set('sync.server.username', trimmed); } }, @@ -181,7 +179,9 @@ Zotero_Preferences.Sync = { Zotero.Sync.Runner.deleteAPIKey(); return; } - + + Zotero.Prefs.set('sync.server.username', username); + // It shouldn't be possible for a sync to be in progress if the user wasn't logged in, // but check to be sure if (!Zotero.Sync.Runner.syncInProgress) { diff --git a/chrome/content/zotero/preferences/preferences_sync.xhtml b/chrome/content/zotero/preferences/preferences_sync.xhtml index f4b37ef1d7..ead8ef931b 100644 --- a/chrome/content/zotero/preferences/preferences_sync.xhtml +++ b/chrome/content/zotero/preferences/preferences_sync.xhtml @@ -34,7 +34,6 @@