Skip to content

Commit

Permalink
The Forbidden presenter can echo more messages
Browse files Browse the repository at this point in the history
  • Loading branch information
spaze committed Jul 26, 2024
1 parent 2cddd0b commit 1635055
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion site/app/Www/Presenters/BasePresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ protected function startup(): void
parent::startup();
$this->httpResponse->addHeader('Vary', 'Cookie');
if ($this->authenticator->isForbidden() && $this->getRequest()?->getMethod() !== Request::FORWARD) {
$this->forward(':Www:Forbidden:');
$this->forward(':Www:Forbidden:', ['message' => 'messages.forbidden.spam']);
}
}

Expand Down
3 changes: 2 additions & 1 deletion site/app/Www/Presenters/ForbiddenPresenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ protected function startup(): void
}


public function actionDefault(): void
public function actionDefault(string $message): void
{
$this->httpResponse->setCode(IResponse::S403_Forbidden);
$this->template->pageTitle = $this->translator->translate('messages.title.forbidden');
$this->template->message = $this->translator->translate($message);
}

}
2 changes: 1 addition & 1 deletion site/app/Www/Presenters/templates/Forbidden/default.latte
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{define #content}
<p>{_messages.forbidden.spam}</p>
<p>{$message}</p>
{/define}

0 comments on commit 1635055

Please sign in to comment.