Allow typing of usernames with spaces in the middle
This commit is contained in:
parent
fa541106c2
commit
352eff2f04
2 changed files with 16 additions and 3 deletions
|
@ -85,7 +85,6 @@ Zotero_Preferences.Sync = {
|
||||||
|
|
||||||
credentialsKeyPress: function (event) {
|
credentialsKeyPress: function (event) {
|
||||||
var username = document.getElementById('sync-username-textbox');
|
var username = document.getElementById('sync-username-textbox');
|
||||||
username.value = username.value.trim();
|
|
||||||
var password = document.getElementById('sync-password');
|
var password = document.getElementById('sync-password');
|
||||||
|
|
||||||
var syncAuthButton = document.getElementById('sync-auth-button');
|
var syncAuthButton = document.getElementById('sync-auth-button');
|
||||||
|
@ -105,7 +104,20 @@ Zotero_Preferences.Sync = {
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
trimUsername: function () {
|
||||||
|
var tb = document.getElementById('sync-username-textbox');
|
||||||
|
var username = tb.value;
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
linkAccount: Zotero.Promise.coroutine(function* (event) {
|
linkAccount: Zotero.Promise.coroutine(function* (event) {
|
||||||
|
this.trimUsername();
|
||||||
var username = document.getElementById('sync-username-textbox').value;
|
var username = document.getElementById('sync-username-textbox').value;
|
||||||
var password = document.getElementById('sync-password').value;
|
var password = document.getElementById('sync-password').value;
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@
|
||||||
<label value="&zotero.preferences.sync.username;"/>
|
<label value="&zotero.preferences.sync.username;"/>
|
||||||
<textbox id="sync-username-textbox"
|
<textbox id="sync-username-textbox"
|
||||||
preference="pref-sync-username"
|
preference="pref-sync-username"
|
||||||
|
onblur="Zotero_Preferences.Sync.trimUsername()"
|
||||||
onkeypress="Zotero_Preferences.Sync.credentialsKeyPress(event);"/>
|
onkeypress="Zotero_Preferences.Sync.credentialsKeyPress(event);"/>
|
||||||
</row>
|
</row>
|
||||||
<row>
|
<row>
|
||||||
|
|
Loading…
Reference in a new issue