Albert221 has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/394860 )
Change subject: Move links from i18n to software
......................................................................
Move links from i18n to software
Bug: T59181
Change-Id: I46de236687020d1af64571738cce236c1fdaafa6
---
M api/MWOAuthSessionProvider.php
M backend/MWOAuthDataStore.php
M backend/MWOAuthServer.php
M frontend/specialpages/SpecialMWOAuth.php
M i18n/en.json
5 files changed, 81 insertions(+), 20 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAuth
refs/changes/60/394860/1
diff --git a/api/MWOAuthSessionProvider.php b/api/MWOAuthSessionProvider.php
index f5cb4bf..2c709a3 100644
--- a/api/MWOAuthSessionProvider.php
+++ b/api/MWOAuthSessionProvider.php
@@ -98,7 +98,11 @@
// There exists a local user
$localUser = MWOAuthUtils::getLocalUserFromCentralId(
$access->get( 'userId' ) );
if ( !$localUser || !$localUser->isLoggedIn() ) {
- return $this->makeException(
'mwoauth-invalid-authorization-invalid-user' );
+ return $this->makeException(
'mwoauth-invalid-authorization-invalid-user', \Linker::makeExternalLink(
+
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E008',
+ 'E008',
+ true
+ ) );
}
if ( $localUser->isLocked() ||
( $this->config->get( 'BlockDisablesLogin' ) &&
$localUser->isBlocked() )
diff --git a/backend/MWOAuthDataStore.php b/backend/MWOAuthDataStore.php
index 02fbe00..6fcdc4e 100644
--- a/backend/MWOAuthDataStore.php
+++ b/backend/MWOAuthDataStore.php
@@ -66,7 +66,13 @@
throw new MWOAuthException(
'mwoauthdatastore-request-token-already-used' );
}
if ( $token === null || !( $returnToken instanceof
MWOAuthToken ) ) {
- throw new MWOAuthException(
'mwoauthdatastore-request-token-not-found' );
+ throw new MWOAuthException(
'mwoauthdatastore-request-token-not-found', [
+ \Linker::makeExternalLink(
+
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E004',
+ 'E004',
+ true
+ )
+ ] );
}
} elseif ( $token_type === 'access' ) {
$cmra = MWOAuthConsumerAcceptance::newFromToken(
$this->centralSlave, $token );
diff --git a/backend/MWOAuthServer.php b/backend/MWOAuthServer.php
index 4905e29..e0645f9 100644
--- a/backend/MWOAuthServer.php
+++ b/backend/MWOAuthServer.php
@@ -277,11 +277,21 @@
// Check that user and consumer are in good standing
if ( $mwUser->isLocked() || $wgBlockDisablesLogin &&
$mwUser->isBlocked() ) {
- throw new MWOAuthException(
'mwoauthserver-insufficient-rights' );
+ throw new MWOAuthException(
'mwoauthserver-insufficient-rights', \Linker::makeExternalLink(
+
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E007',
+ 'E007',
+ true
+ ) );
}
$consumer = $this->data_store->lookup_consumer( $consumerKey );
if ( !$consumer || $consumer->get( 'deleted' ) ) {
- throw new MWOAuthException(
'mwoauthserver-bad-consumer-key' );
+ throw new MWOAuthException(
'mwoauthserver-bad-consumer-key', [
+ \Linker::makeExternalLink(
+
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E006',
+ 'E006',
+ true
+ )
+ ] );
} elseif ( !$consumer->isUsableBy( $mwUser ) ) {
$owner = MWOAuthUtils::getCentralUserNameFromId(
$consumer->get( 'userId' ),
@@ -289,7 +299,11 @@
);
throw new MWOAuthException(
'mwoauthserver-bad-consumer',
- [ $consumer->get( 'name' ),
MWOAuthUtils::getCentralUserTalk( $owner ) ]
+ [ $consumer->get( 'name' ),
MWOAuthUtils::getCentralUserTalk( $owner ), \Linker::makeExternalLink(
+
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E005',
+ 'E005',
+ true
+ ) ]
);
} elseif ( $consumer->get( 'ownerOnly' ) ) {
throw new MWOAuthException(
'mwoauthserver-consumer-owner-only', [
@@ -317,7 +331,11 @@
$centralUserId = MWOAuthUtils::getCentralIdFromLocalUser(
$mwUser );
if ( !$centralUserId ) {
$userMsg = MWOAuthUtils::getSiteMessage(
'mwoauthserver-invalid-user' );
- throw new MWOAuthException( $userMsg, [ $consumer->get(
'name' ) ] );
+ throw new MWOAuthException( $userMsg, [ $consumer->get(
'name' ), \Linker::makeExternalLink(
+
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E008',
+ 'E008',
+ true
+ ) ] );
}
// Authorization Token
@@ -389,7 +407,11 @@
$centralUserId = MWOAuthUtils::getCentralIdFromLocalUser(
$mwUser );
if ( !$centralUserId ) {
- $userMsg = MWOAuthUtils::getSiteMessage(
'mwoauthserver-invalid-user' );
+ $userMsg = MWOAuthUtils::getSiteMessage(
'mwoauthserver-invalid-user', \Linker::makeExternalLink(
+
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E008',
+ 'E008',
+ true
+ ) );
throw new MWOAuthException( $userMsg, [ $consumer->get(
'name' ) ] );
}
diff --git a/frontend/specialpages/SpecialMWOAuth.php
b/frontend/specialpages/SpecialMWOAuth.php
index e36708f..a7874be 100644
--- a/frontend/specialpages/SpecialMWOAuth.php
+++ b/frontend/specialpages/SpecialMWOAuth.php
@@ -132,7 +132,14 @@
$verifier = $request->getVal(
'oauth_verifier', false );
$requestToken = $request->getVal(
'oauth_token', false );
if ( !$verifier || !$requestToken ) {
- throw new MWOAuthException(
'mwoauth-bad-request-missing-params' );
+ throw new MWOAuthException(
+
'mwoauth-bad-request-missing-params',
+ [ \Linker::makeExternalLink(
+
'https://www.mediawiki.org/wiki/Special:MyLanguage/Help:OAuth',
+ 'Contact support',
+ true
+ ) ]
+ );
}
$this->getOutput()->addSubtitle(
$this->msg( 'mwoauth-desc' )->escaped() );
$this->showResponse(
@@ -162,7 +169,14 @@
$access =
MWOAuthConsumerAcceptance::newFromToken( $dbr, $token->key );
$localUser =
MWOAuthUtils::getLocalUserFromCentralId( $access->get( 'userId' ) );
if ( !$localUser ||
!$localUser->isLoggedIn() ) {
- throw new MWOAuthException(
'mwoauth-invalid-authorization-invalid-user' );
+ throw new MWOAuthException(
+
'mwoauth-invalid-authorization-invalid-user',
+ \Linker::makeExternalLink(
+
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E008',
+ 'E008',
+ true
+ )
+ );
} elseif ( $localUser->isLocked() ||
$wgBlockDisablesLogin &&
$localUser->isBlocked()
) {
@@ -195,7 +209,13 @@
if ( !$cmr ) {
$this->showError(
- wfMessage(
'mwoauth-bad-request-invalid-action' ),
+ wfMessage(
'mwoauth-bad-request-invalid-action',
+ \Linked::makeExternalLink(
+
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E002',
+ 'E002',
+ true
+ )
+ ),
$format
);
} else {
@@ -203,7 +223,12 @@
$cmr->get( 'userId' ),
$this->getUser() );
$this->showError(
wfMessage(
'mwoauth-bad-request-invalid-action-contact',
-
MWOAuthUtils::getCentralUserTalk( $owner )
+
MWOAuthUtils::getCentralUserTalk( $owner ),
+ \Linker::makeExternalLink(
+
'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E003',
+ 'E003',
+ true
+ )
),
$format
);
@@ -318,7 +343,11 @@
$this->getContext()
);
if ( !$cmr ) {
- throw new MWOAuthException(
'mwoauthserver-bad-consumer-key' );
+ throw new MWOAuthException(
'mwoauthserver-bad-consumer-key', \Linker::makeExternalLink(
+ 'https://www.mediawiki.org/wiki/Help:OAuth/Errors#E006',
+ 'E006',
+ true
+ ) );
} elseif ( !$cmr->getDAO()->isUsableBy( $user ) ) {
throw new MWOAuthException(
'mwoauthserver-bad-consumer',
diff --git a/i18n/en.json b/i18n/en.json
index d8ead7e..e2c284a 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -193,11 +193,11 @@
"logentry-mwoauthconsumer-create-owner-only": "$1 {{GENDER:$2|created}}
an owner-only OAuth consumer (consumer key $4)",
"mwoauthconsumer-consumer-logpage": "OAuth consumer log",
"mwoauthconsumer-consumer-logpagetext": "Log of approvals, rejections,
and disabling of registered OAuth consumers.",
- "mwoauth-bad-request-missing-params": "Sorry, something went wrong
configuring this connected application. <span
class=\"plainlinks\">[https://www.mediawiki.org/wiki/Special:MyLanguage/Help:OAuth
Contact support]</span> to get help fixing it.\n\n<span class=\"plainlinks
mw-mwoautherror-details\">OAuth missing parameters,
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E001 E001]</span>",
- "mwoauth-bad-request-invalid-action": "Sorry, something went wrong,
you'll need to contact the application author for help with this.\n\n<span
class=\"plainlinks mw-mwoautherror-details\">Unknown URL,
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E002 E002]</span>",
- "mwoauth-bad-request-invalid-action-contact": "Sorry, something went
wrong. You'll need to [$1 contact] the application author for help with
this.\n\n<span class=\"plainlinks mw-mwoautherror-details\">Unknown URL,
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E003 E003]</span>",
+ "mwoauth-bad-request-missing-params": "Sorry, something went wrong
configuring this connected application. <span class=\"plainlinks\">$1</span> to
get help fixing it.\n\n<span class=\"plainlinks mw-mwoautherror-details\">OAuth
missing parameters, [https://www.mediawiki.org/wiki/Help:OAuth/Errors#E001
E001]</span>",
+ "mwoauth-bad-request-invalid-action": "Sorry, something went wrong,
you'll need to contact the application author for help with this.\n\n<span
class=\"plainlinks mw-mwoautherror-details\">Unknown URL, $1</span>",
+ "mwoauth-bad-request-invalid-action-contact": "Sorry, something went
wrong. You'll need to [$1 contact] the application author for help with
this.\n\n<span class=\"plainlinks mw-mwoautherror-details\">Unknown URL,
$2</span>",
"mwoauthdatastore-access-token-not-found": "No approved grant was found
for that authorization token.",
- "mwoauthdatastore-request-token-not-found": "Sorry, something went
wrong connecting this application.\nGo back and try to connect your account
again, or contact the application author.\n\n<span class=\"plainlinks
mw-mwoautherror-details\">OAuth token not found,
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E004 E004]</span>",
+ "mwoauthdatastore-request-token-not-found": "Sorry, something went
wrong connecting this application.\nGo back and try to connect your account
again, or contact the application author.\n\n<span class=\"plainlinks
mw-mwoautherror-details\">OAuth token not found, $1</span>",
"mwoauthdatastore-callback-not-found": "OAuth callback URL not found in
cache. This is probably an error in how the application makes requests to the
server.",
"mwoauthdatastore-request-token-already-used": "This request has
already been completed and cannot be resubmitted.\nGo back to the application
and try to connect your account again, or contact the application
author.\n\n<span class=\"plainlinks mw-mwoautherror-details\">OAuth token
already used, [https://www.mediawiki.org/wiki/Help:OAuth/Errors#E009
E009]</span>",
"mwoauthdatastore-bad-token": "No token was found matching your
request.",
@@ -205,11 +205,11 @@
"mwoauthdatastore-bad-verifier": "The verification code provided was
not valid.",
"mwoauthdatastore-invalid-token-type": "The requested token type is
invalid.",
"mwoauthgrants-general-error": "There was an error in your OAuth
request.",
- "mwoauthserver-bad-consumer": "\"$1\" is not approved as a Connected
App. [$2 Contact] the application author for help.\n\n<span class=\"plainlinks
mw-mwoautherror-details\">Connected OAuth app not approved,
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E005 E005]</span>",
- "mwoauthserver-bad-consumer-key": "Sorry, something went wrong
connecting this application.\n\n<span class=\"plainlinks
mw-mwoautherror-details\">Unknown OAuth key,
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E006 E006]</span>",
- "mwoauthserver-insufficient-rights": "Your account is not allowed to
use Connected Apps, contact your site administrator to find out why.\n\n<span
class=\"plainlinks mw-mwoautherror-details\">Insufficient OAuth user rights,
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E007 E007]</span>",
+ "mwoauthserver-bad-consumer": "\"$1\" is not approved as a Connected
App. [$2 Contact] the application author for help.\n\n<span class=\"plainlinks
mw-mwoautherror-details\">Connected OAuth app not approved, $3</span>",
+ "mwoauthserver-bad-consumer-key": "Sorry, something went wrong
connecting this application.\n\n<span class=\"plainlinks
mw-mwoautherror-details\">Unknown OAuth key, $1</span>",
+ "mwoauthserver-insufficient-rights": "Your account is not allowed to
use Connected Apps, contact your site administrator to find out why.\n\n<span
class=\"plainlinks mw-mwoautherror-details\">Insufficient OAuth user rights,
$1</span>",
"mwoauthserver-invalid-request-token": "Invalid token in your request.",
- "mwoauthserver-invalid-user": "To use Connected Apps on this site, you
must have an account across all projects. When you have an account on all
projects, you can try to connect \"$1\" again.\n\n<span class=\"plainlinks
mw-mwoautherror-details\">Unified login needed,
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E008 E008]</span>",
+ "mwoauthserver-invalid-user": "To use Connected Apps on this site, you
must have an account across all projects. When you have an account on all
projects, you can try to connect \"$1\" again.\n\n<span class=\"plainlinks
mw-mwoautherror-details\">Unified login needed, $2</span>",
"mwoauthserver-consumer-no-secret": "Sorry, something went wrong
connecting this application.\n\n<span class=\"plainlinks
mw-mwoautherror-details\">Consumer has no secret key,
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E009 E009]</span>",
"mwoauthserver-consumer-owner-only": "\"$1\" is an owner-only Connected
App. To fetch the access token, see [[$2]].\n\n<span class=\"plainlinks
mw-mwoautherror-details\">Consumer is owner-only,
[https://www.mediawiki.org/wiki/Help:OAuth/Errors#E010 E010]</span>",
"mwoauth-invalid-authorization-title": "OAuth authorization error",
--
To view, visit https://gerrit.wikimedia.org/r/394860
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I46de236687020d1af64571738cce236c1fdaafa6
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: Albert221 <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits