Wikidata extension - discourage use of main password (#3190)

* encourage using bot passwords

* update wiki link

* update translation

* Update extensions/wikidata/module/langs/translation-en.json

Co-authored-by: Tom Morris <tfmorris@gmail.com>

Co-authored-by: Tom Morris <tfmorris@gmail.com>
This commit is contained in:
Lu Liu 2020-09-30 22:31:36 +08:00 committed by GitHub
parent b9db24d962
commit 79eac0b811
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 0 deletions

View File

@ -80,6 +80,8 @@
"wikibase-preview/new-id": "new item",
"wikibase-account/dialog-header": "$1 account",
"wikibase-account/explain-log-in": "Logging in to <a href=\"$1\" target=\"_blank\">$2</a> lets you to upload edits directly from OpenRefine.",
"wikibase-account/explain-bot-passwords": "You are encouraged to login with <a href=\"$1\" target=\"_blank\">bot passwords</a>, see this <a href=\"https://docs.openrefine.org/manual/wikidata#manage-wikidata-account\" target=\"_blank\">wiki page</a> to learn how to get one.",
"wikibase-account/bot-passwords-alert": "You are appearing to use your main password to login in. We encourage you to use bot password to login. For bot password, the username should be in the form of \"yourwikidatausername@yourbotname\".",
"wikibase-account/explain-owner-only-consumer-wiki": "You need to register an owner-only consumer <a href=\"$1\" target=\"_blank\">here</a> first if you don't have one. See this <a href=\"https://github.com/OpenRefine/OpenRefine/wiki/Wikidata-owner-only-consumer\" target=\"_blank\">wiki</a> to learn how to get one.",
"wikibase-account/explain-password-login": "You can also <a>login with your username/password.</a>",
"wikibase-account/explain-owner-only-consumer-login": "You can also <a>login with your owner-only consumer.</a>",

View File

@ -79,6 +79,7 @@ ManageAccountDialog.displayPasswordLogin = function (onSuccess) {
const frame = $(DOM.loadHTML("wikidata", "scripts/dialogs/password-login-dialog.html"));
const elmts = DOM.bind(frame);
ManageAccountDialog.initCommon(elmts);
elmts.explainBotPasswords.html($.i18n('wikibase-account/explain-bot-passwords', WikibaseManager.getSelectedWikibaseRoot() + 'Special:BotPasswords'));
elmts.explainOwnerOnlyConsumerLogin.html($.i18n('wikibase-account/explain-owner-only-consumer-login'));
elmts.invalidCredentials.text($.i18n('wikibase-account/invalid-credentials'));
elmts.invalidCredentials.hide();
@ -113,6 +114,10 @@ ManageAccountDialog.displayPasswordLogin = function (onSuccess) {
elmts.loginForm.submit(function (e) {
frame.hide();
let formArr = elmts.loginForm.serializeArray();
let username = elmts.usernameInput.val();
if (!username.contains("@")) {
alert($.i18n('wikibase-account/bot-passwords-alert'));
}
formArr.push({name: "wb-api-endpoint", value: WikibaseManager.getSelectedWikibaseApi()});
Refine.postCSRF(
"command/wikidata/login",

View File

@ -8,6 +8,7 @@
</div>
<div class="right-of-logo">
<p class="body-text" bind="explainLogIn"></p>
<p class="body-text" bind="explainBotPasswords"></p>
<div class="wikibase-user-management-area">
<div class="wikibase-user-login" bind="loginArea">
<p bind="invalidCredentials" class="wikibase-invalid-credentials"></p>