Skip to content

Commit

Permalink
Added missing translations
Browse files Browse the repository at this point in the history
  • Loading branch information
akadlec committed Aug 5, 2020
1 parent 0423094 commit 49e8107
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Middleware/CorsMiddleware.php
Expand Up @@ -109,22 +109,22 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
switch ($cors->getRequestType()) {
case CorsAnalysisResultInterface::ERR_ORIGIN_NOT_ALLOWED:
throw new NodeJsonApiExceptions\JsonApiErrorException(
StatusCodeInterface::STATUS_UNAUTHORIZED,
$this->translator->translate('//node.base.messages.notAllowed.heading'),
StatusCodeInterface::STATUS_FORBIDDEN,
$this->translator->translate('//node.base.messages.forbidden.heading'),
'CORS request origin is not allowed.'
);

case CorsAnalysisResultInterface::ERR_METHOD_NOT_SUPPORTED:
throw new NodeJsonApiExceptions\JsonApiErrorException(
StatusCodeInterface::STATUS_UNAUTHORIZED,
$this->translator->translate('//node.base.messages.notAllowed.heading'),
StatusCodeInterface::STATUS_FORBIDDEN,
$this->translator->translate('//node.base.messages.forbidden.heading'),
'CORS requested method is not supported.'
);

case CorsAnalysisResultInterface::ERR_HEADERS_NOT_SUPPORTED:
throw new NodeJsonApiExceptions\JsonApiErrorException(
StatusCodeInterface::STATUS_UNAUTHORIZED,
$this->translator->translate('//node.base.messages.notAllowed.heading'),
StatusCodeInterface::STATUS_FORBIDDEN,
$this->translator->translate('//node.base.messages.forbidden.heading'),
'CORS requested header is not allowed.'
);

Expand Down
9 changes: 9 additions & 0 deletions src/Translations/node.en_US.neon
Expand Up @@ -12,3 +12,12 @@
#
# @date 14.04.20
#

base:
messages:
notAuthorized:
heading : "Not authorized"
message : "This request is not authorized to perform this action"
forbidden:
heading : "Not allowed"
message : "You are not allowed to perform this action"

0 comments on commit 49e8107

Please sign in to comment.