Skip to content

Commit

Permalink
Use StyleWithNonce element
Browse files Browse the repository at this point in the history
  • Loading branch information
sukhwinder33445 authored and nilmerg committed Sep 8, 2023
1 parent ca78cf1 commit 244c5b1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions library/Reporting/Web/Widget/CoverPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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()))
]);
Expand All @@ -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);
Expand Down

0 comments on commit 244c5b1

Please sign in to comment.