Fix Wikidata login form, closes #2194

This commit is contained in:
Antonin Delpeuch 2020-01-06 11:40:02 +01:00
parent 904129d0f7
commit 1046c38727
2 changed files with 13 additions and 10 deletions

View File

@ -27,7 +27,7 @@
</table>
<div class="wikibase-login-buttons">
<button class="button cancel-button" bind="cancelButton1"></button>
<button class="button button-primary" type="submit" bind="loginButton"></button>
<input class="button button-primary" type="submit" bind="loginButton"></input>
</div>
</form>
</div>

View File

@ -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);
});