Jump to content

Is there a Hook for initial page load?


Recommended Posts

Hello guys,
I have been setting up a SAML Auth for my website for a few days with SamlAuth and the last thing left is to hook the initial login to when the visitor loads for the first time any page of the website.

The module uses ProcessLogin::renderLoginForm which is perfect for when a user accesses the admin but I want to close the whole website off. I don't want to use the PageProtector as I find it an overkill for such redirection purpose. I also tried Page::loaded which created an infinite loop ?.

So is there a Hook I can use or another method which makes more sense?

Thank you!

Link to comment
Share on other sites

18 minutes ago, louisstephens said:

I have not really done any hooks on page load, but from my understanding there are 2 that might suit your needs: Page::render (before) of ProcessPageView::execute . However, someone please correct me if I have my information mixed up.

Thanks for the suggestion, however this has the same infinite loop effect as the ::loaded hook. It just goes Page::render -> Saml -> Page::render -> Saml -> ...

Okay, that's silly but I just added a condition to actually check for the Saml Response. This way it doesn't try it after the user is in... Thanks @louisstephens

if (!isset($_SESSION['samlUserdata'])) { // User not logged in to SAML 
    $this->session->addHookBefore('PageRender::renderPage', $this, 'loginsaml');


  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...