only save username to prefs on successful login (#3192)

Failing to login does not update the username in prefs.

Fixes #2901
This commit is contained in:
abaevbog 2023-07-05 04:11:56 -04:00 committed by GitHub
parent 13571f9fd2
commit 04496fadcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View file

@ -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) {

View file

@ -34,7 +34,6 @@
<html:div class="form-grid">
<label value="&zotero.preferences.sync.username;"/>
<html:input id="sync-username-textbox"
preference="extensions.zotero.sync.server.username"
onblur="Zotero_Preferences.Sync.trimUsername()"
oninput="Zotero_Preferences.Sync.credentialsChange(event)"
onchange="Zotero_Preferences.Sync.credentialsChange(event)"