Added fuctionality of form submit by enter key in Wikidata Login dialogue

This commit is contained in:
Bhanu Gupta 2019-12-21 05:21:43 +05:30
parent 3911636f0d
commit cfc962668c

View File

@ -70,6 +70,25 @@ ManageAccountDialog.display = function(logged_in_username, saved_credentials, ca
}); });
}); });
document.addEventListener('keydown', function(event) {
if (event.keyCode == 13) {
frame.hide();
Refine.postCSRF(
"command/wikidata/login",
elmts.loginForm.serialize(),
function(data) {
if (data.logged_in) {
dismiss();
callback(data.username);
} else {
frame.show();
elmts.invalidCredentials.text("Invalid credentials.");
}
});
}
});
elmts.logoutButton.click(function() { elmts.logoutButton.click(function() {
Refine.postCSRF( Refine.postCSRF(
"command/wikidata/login", "command/wikidata/login",