Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoid CMS coupling #9830

Open
wants to merge 1 commit into
base: 4
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/Security/Security.php
Original file line number Diff line number Diff line change
Expand Up @@ -579,8 +579,13 @@ protected function getResponseController($title)
$holderPage->URLSegment = 'Security';
// Disable ID-based caching of the log-in page by making it a random number
$holderPage->ID = -1 * random_int(1, 10000000);

if ($holderPage instanceof Controller) {
$controller = $holderPage;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this go a bit higher in the method after the Injector call and move setting the title, url segment and ID into the condition when it's not an instance of a controller? Even though it might work it seems a bit hacky this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree. Actually I believe that what would be nice is to set some kind of callback to generate the page. This way this code could be shifted into the CMS module altogether and avoid coupling entirely. But that requires coordinated changes between the framework and CMS module. It's not logical that the security class has knowledge of the page class.

} else {
$controller = ModelAsController::controller_for($holderPage);
}

$controller = ModelAsController::controller_for($holderPage);
$controller->setRequest($this->getRequest());
$controller->doInit();

Expand Down