From 244c5b1e0b41fd6e39fa83571bcc267079e219c8 Mon Sep 17 00:00:00 2001 From: Sukhwinder Dhillon Date: Fri, 8 Sep 2023 16:59:09 +0200 Subject: [PATCH] Use `StyleWithNonce` element --- library/Reporting/Web/Widget/CoverPage.php | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/library/Reporting/Web/Widget/CoverPage.php b/library/Reporting/Web/Widget/CoverPage.php index bf93e6d..5b95a45 100644 --- a/library/Reporting/Web/Widget/CoverPage.php +++ b/library/Reporting/Web/Widget/CoverPage.php @@ -3,10 +3,9 @@ namespace Icinga\Module\Reporting\Web\Widget; use Icinga\Module\Reporting\Common\Macros; -use Icinga\Util\Csp; use ipl\Html\BaseHtmlElement; use ipl\Html\Html; -use ipl\Web\Style; +use ipl\Web\Compat\StyleWithNonce; class CoverPage extends BaseHtmlElement { @@ -140,9 +139,8 @@ public function setTitle($title) protected function assemble() { if ($this->hasBackgroundImage()) { - $coverPageBackground = (new Style()) + $coverPageBackground = (new StyleWithNonce()) ->setModule('reporting') - ->setNonce(Csp::getStyleNonce()) ->addFor($this, [ 'background-image' => sprintf("url('%s')", Template::getDataUrl($this->getBackgroundImage())) ]); @@ -152,9 +150,8 @@ protected function assemble() $content = Html::tag('div', ['class' => 'cover-page-content']); if ($this->hasColor()) { - $coverPageLogo = (new Style()) + $coverPageLogo = (new StyleWithNonce()) ->setModule('reporting') - ->setNonce(Csp::getStyleNonce()) ->addFor($content, ['color' => $this->getColor()]); $content->addHtml($coverPageLogo);