Update for API error i18n

See Iae0e2ce3.

Change-Id: Ie30549363b079ea23d6eab5959d10ada8f74acdf
This commit is contained in:
Brad Jorsch 2016-11-03 15:16:56 -04:00 committed by Reedy
parent 22afe69466
commit 47d7c04496
4 changed files with 7 additions and 15 deletions

View file

@ -32,21 +32,16 @@ class ApiOATHValidate extends ApiBase {
$params['user'] = $this->getUser()->getName();
}
if ( !$this->getUser()->isAllowed( 'oathauth-api-all' ) ) {
$this->dieUsage(
'You do not have permission to validate an OATH token',
'permissiondenied'
);
}
$this->checkUserRightsAny( 'oathauth-api-all' );
$user = User::newFromName( $params['user'] );
if ( $user === false ) {
$this->dieUsageMsg( [ 'noname', $params['user'] ] );
$this->dieWithError( 'noname' );
}
// Don't increase pingLimiter, just check for limit exceeded.
if ( $user->pingLimiter( 'badoath', 0 ) ) {
$this->dieUsageMsg( 'actionthrottledtext' );
$this->dieWithError( 'apierror-ratelimited' );
}
$result = [

View file

@ -37,16 +37,11 @@ class ApiQueryOATH extends ApiQueryBase {
$params['user'] = $this->getUser()->getName();
}
if ( !$this->getUser()->isAllowed( 'oathauth-api-all' ) ) {
$this->dieUsage(
'You do not have permission to check OATH status',
'permissiondenied'
);
}
$this->checkUserRightsAny( 'oathauth-api-all' );
$user = User::newFromName( $params['user'] );
if ( $user === false ) {
$this->dieUsageMsg( [ 'noname', $params['user'] ] );
$this->dieWithError( 'noname' );
}
$result = $this->getResult();

View file

@ -56,6 +56,7 @@
"grant-group-authentication": "Perform authentication actions for self and others",
"grant-oath": "Access two-factor authentication (OATH) information for self and others",
"right-oathauth-api-all": "Query and validate OATH information for self and others",
"action-oathauth-api-all": "check OATH status",
"apihelp-query+oath-description": "Check to see if two-factor authentication (OATH) is enabled for a user.",
"apihelp-query+oath-param-user": "User to get information about. Defaults to the current user.",
"apihelp-query+oath-example-1": "Get information about the current user",

View file

@ -61,6 +61,7 @@
"grant-group-authentication": "{{Related|Grant-group}}",
"grant-oath": "Name for grant \"oath\".\n{{Related|Grant}}",
"right-oathauth-api-all": "{{doc-right|oathauth-api-all}}",
"action-oathauth-api-all": "{{doc-action|oathauth-api-all}}",
"apihelp-query+oath-description": "{{doc-apihelp-description|query+oath}}",
"apihelp-query+oath-param-user": "{{doc-apihelp-param|query+oath|user}}",
"apihelp-query+oath-example-1": "{{doc-apihelp-example|query+oath}}",