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

BUG use_only_x_path requires CMS user to re-authenticate on publish of page #24

Open
muskie9 opened this issue Apr 5, 2022 · 2 comments

Comments

@muskie9
Copy link
Contributor

muskie9 commented Apr 5, 2022

This issue has been brought up a couple times and our implementations tend to utilize the use_only_x_path quite a bit and when a page is published it prompts the login overlay within the CMS.

We're reviewing how the code acts with use_only_x_path enabled from a session perspective, mainly surrounding the use of Directory::test() however we have not identified the core issue. Not implementing the `use_only_x_path config option results in normal CMS activity.

@muskie9
Copy link
Contributor Author

muskie9 commented May 19, 2022

I came across this comment silverstripe/silverstripe-sharedraftcontent#153 (comment) when looking at an unrelated issue and thought it may have some insight into how the session could be invalidated causing the user to have to re-auth.

@jellygnite
Copy link

jellygnite commented Jul 12, 2022

It would be nice to solve the issue with Director::test(), but in the meantime would it be feasible to replace the line
$output[] = Director::test($searchLink);
with a different method.
This module does things a little differently. Looks like it creates a separate session and just renders the page with $page->forTemplate()
https://github.com/wilr/silverstripe-algolia/blob/main/src/Service/AlgoliaPageCrawler.php

I also note from
SilverStripe\ErrorPage\ErrorPage.php](https://github.com/silverstripe/silverstripe-errorpage/blob/1/src/ErrorPage.php

        // Run the page (reset the theme, it might've been disabled by LeftAndMain::init())
        $originalThemes = SSViewer::get_themes();
        try {
            // Restore front-end themes from config
            $themes = SSViewer::config()->get('themes') ?: $originalThemes;
            SSViewer::set_themes($themes);

            // Render page as non-member in live mode
            $response = Member::actAs(null, function () {
                $response = Director::test(Director::makeRelative($this->getAbsoluteLiveLink()));
                return $response;
            });

            $errorContent = $response->getBody();
        } finally {
            // Restore themes
            SSViewer::set_themes($originalThemes);
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants