From 1046c38727a70192d48e677656875d386b644b12 Mon Sep 17 00:00:00 2001 From: Antonin Delpeuch Date: Mon, 6 Jan 2020 11:40:02 +0100 Subject: [PATCH] Fix Wikidata login form, closes #2194 --- .../dialogs/manage-account-dialog.html | 2 +- .../scripts/dialogs/manage-account-dialog.js | 21 +++++++++++-------- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/extensions/wikidata/module/scripts/dialogs/manage-account-dialog.html b/extensions/wikidata/module/scripts/dialogs/manage-account-dialog.html index bbfe3788d..b2eec7ca6 100644 --- a/extensions/wikidata/module/scripts/dialogs/manage-account-dialog.html +++ b/extensions/wikidata/module/scripts/dialogs/manage-account-dialog.html @@ -27,7 +27,7 @@
- +
diff --git a/extensions/wikidata/module/scripts/dialogs/manage-account-dialog.js b/extensions/wikidata/module/scripts/dialogs/manage-account-dialog.js index 28bee2cdb..0e7e71107 100644 --- a/extensions/wikidata/module/scripts/dialogs/manage-account-dialog.js +++ b/extensions/wikidata/module/scripts/dialogs/manage-account-dialog.js @@ -17,7 +17,6 @@ ManageAccountDialog.display = function(logged_in_username, saved_credentials, ca var self = this; var frame = $(DOM.loadHTML("wikidata", "scripts/dialogs/manage-account-dialog.html")); var elmts = this._elmts = DOM.bind(frame); - ManageAccountDialog.firstLaunch = false; this._elmts.dialogHeader.text($.i18n('wikidata-account/dialog-header')); this._elmts.explainLogIn.html($.i18n('wikidata-account/explain-log-in')); @@ -31,7 +30,13 @@ ManageAccountDialog.display = function(logged_in_username, saved_credentials, ca this._elmts.cancelButton2.text($.i18n('wikidata-account/close')); this._elmts.loggedInAs.text($.i18n('wikidata-account/logged-in-as')); this._elmts.logoutButton.text($.i18n('wikidata-account/log-out')); - this._elmts.loginButton.text($.i18n('wikidata-account/log-in')); + this._elmts.loginButton.val($.i18n('wikidata-account/log-in')); + + if (logged_in_username != null) { + elmts.loginArea.remove(); + } else { + elmts.logoutArea.remove(); + } this._level = DialogSystem.showDialog(frame); @@ -39,17 +44,15 @@ ManageAccountDialog.display = function(logged_in_username, saved_credentials, ca DialogSystem.dismissUntil(self._level - 1); }; - if (logged_in_username != null) { - elmts.loginArea.hide(); - } else { - elmts.logoutArea.hide(); - } - elmts.loggedInUsername .text(logged_in_username) .attr('href', 'https://www.wikidata.org/wiki/User:'+logged_in_username); - frame.find('.cancel-button').click(function() { + elmts.cancelButton1.click(function(e) { + dismiss(); + callback(null); + }); + elmts.cancelButton2.click(function(e) { dismiss(); callback(null); });