Aaron Schulz has uploaded a new change for review.
https://gerrit.wikimedia.org/r/89236
Change subject: Added sanity check for updating "wiki" field of consumer
acceptance
......................................................................
Added sanity check for updating "wiki" field of consumer acceptance
* Also removed an unused message
Change-Id: Id9dc0dbbef5c9497d6ea2b0ef82de7f067817f9a
---
M control/MWOAuthConsumerAcceptanceSubmitControl.php
M frontend/language/MWOAuth.i18n.php
2 files changed, 9 insertions(+), 1 deletion(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/OAuth
refs/changes/36/89236/1
diff --git a/control/MWOAuthConsumerAcceptanceSubmitControl.php
b/control/MWOAuthConsumerAcceptanceSubmitControl.php
index 58a9582..9652a13 100644
--- a/control/MWOAuthConsumerAcceptanceSubmitControl.php
+++ b/control/MWOAuthConsumerAcceptanceSubmitControl.php
@@ -121,6 +121,11 @@
}
$cmr = MWOAuthConsumer::newFromId( $dbw, $cmra->get(
'consumerId' ) );
+ if ( $cmr->get( 'wiki' ) !== '*' && $cmr->get( 'wiki' )
!== $this->vals['wiki'] ) {
+ return $this->failure( 'invalid_wiki',
+ 'mwoauth-invalid-access-wrongwiki',
$cmr->get( 'wiki' ) );
+ }
+
$grants = FormatJSON::decode( $this->vals['grants'],
true );
$cmra->setFields( array(
'wiki' => $this->vals['wiki'],
diff --git a/frontend/language/MWOAuth.i18n.php
b/frontend/language/MWOAuth.i18n.php
index 8bbd77f..6065da6 100644
--- a/frontend/language/MWOAuth.i18n.php
+++ b/frontend/language/MWOAuth.i18n.php
@@ -55,6 +55,7 @@
'mwoauth-consumer-not-approved' => 'The consumer is not approved (it
may have been disabled)',
'mwoauth-invalid-consumer-key' => 'No consumer exists with the given
key.',
'mwoauth-invalid-access-token' => 'No access token exists with the
given key.',
+ 'mwoauth-invalid-access-wrongwiki' => 'The consumer can only be used on
wiki "$1".',
'mwoauth-consumer-conflict' => 'Someone changed the attributes of this
consumer as you viewed it. Please try again. You may want to check the change
log.',
'mwoauth-consumer-stage-proposed' => 'proposed',
@@ -192,7 +193,6 @@
'mwoauthconsumer-consumer-logpage' => 'OAuth consumer log',
'mwoauthconsumer-consumer-logpagetext' => 'Log of approvals,
rejections, and disabling of registered OAuth consumers.',
- 'mwoauth-bad-csrf-token' => 'Session failure when submitting form.
Please try your submissions again.',
'mwoauth-bad-request' => 'There was an error in your OAuth request.',
'mwoauthdatastore-access-token-not-found' => 'No approved grant was
found for that authorization token.',
'mwoauthdatastore-request-token-not-found' => 'No request was found for
that token.',
@@ -829,6 +829,9 @@
'action-mwoauthproposeconsumer' =>
'{{Doc-action|mwoauthproposeconsumer}}',
'action-mwoauthupdateownconsumer' =>
'{{Doc-action|mwoauthupdateownconsumer}}',
'action-mwoauthviewsuppressed' =>
'{{Doc-action|mwoauthviewsuppressed}}',
+
+ 'mwoauth-invalid-access-wrongwiki' => 'Used as error message.
Parameters:
+* $1 - the wiki ID the consumer is applicable to'
);
/** Asturian (asturianu)
--
To view, visit https://gerrit.wikimedia.org/r/89236
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: Id9dc0dbbef5c9497d6ea2b0ef82de7f067817f9a
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/OAuth
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits