Skip to content

Commit

Permalink
Merge pull request #64 from NightJar/allow-error-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
madmatt authored Oct 29, 2024
2 parents 297de70 + 1f82fb3 commit 41088ca
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
8 changes: 8 additions & 0 deletions _config/errorpage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
Name: static-error-page
Only:
moduleexists: silverstripe/errorpage
---
SilverStripe\ErrorPage\ErrorPage:
extensions:
- SilverStripe\SAML\Extensions\ErrorPageStaticPublish
23 changes: 23 additions & 0 deletions src/Extensions/ErrorPageStaticPublish.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php

namespace SilverStripe\SAML\Extensions;

use SilverStripe\ORM\DataExtension;
use SilverStripe\SAML\Middleware\SAMLMiddleware;

class ErrorPageStaticPublish extends DataExtension
{
private ?bool $originallyEnabled = null;

public function onBeforeStaticWrite()
{
$config = SAMLMiddleware::config();
$this->originallyEnabled = $config->get('enabled');
$config->set('enabled', false);
}

public function onAfterStaticWrite()
{
SAMLMiddleware::config()->set('enabled', $this->originallyEnabled);
}
}

0 comments on commit 41088ca

Please sign in to comment.