src/Core/Startup/ErrorControlChainMiddleware.php
protected function safeReloadWithTokens(HTTPRequest $request, ConfirmationTokenChain $confirmationTokenChain)
    {
        // Safe reload requires manual boot
        $this->getApplication()->getKernel()->boot(false);

        // Ensure session is started
        $request->getSession()->init($request);
        
        // Request with ErrorDirector
        $result = ErrorDirector::singleton()->handleRequestWithTokenChain(
            $request,
            $confirmationTokenChain,
            $this->getApplication()->getKernel()
        );
        if ($result) {
            return $result;
        }

        // Fail and redirect the user to the login page
        $params = array_merge($request->getVars(), $confirmationTokenChain->params(false));
        $backURL = $confirmationTokenChain->getRedirectUrlBase() . '?' . http_build_query($params);
        $loginPage = Director::absoluteURL(Security::config()->get('login_url'));
        $loginPage .= "?BackURL=" . urlencode($backURL);
        $result = new HTTPResponse();
        $result->redirect($loginPage);
        return $result;
    }
protected function safeReloadWithTokens(HTTPRequest $request, ConfirmationTokenChain $confirmationTokenChain)
    {
        // Safe reload requires manual boot
        $this->getApplication()->getKernel()->boot(false);

        // Ensure session is started
        $request->getSession()->init($request);
        
        // Request with ErrorDirector
        $result = ErrorDirector::singleton()->handleRequestWithTokenChain(
            $request,
            $confirmationTokenChain,
            $this->getApplication()->getKernel()
        );
        if ($result) {
            return $result;
        }

        // Fail and redirect the user to the login page
        $params = array_merge($request->getVars(), $confirmationTokenChain->params(false));
        $backURL = $confirmationTokenChain->getRedirectUrlBase() . '?' . http_build_query($params);
        $loginPage = Director::absoluteURL(Security::config()->get('login_url'));
        $loginPage .= "?BackURL=" . urlencode($backURL);
        $result = new HTTPResponse();
        $result->redirect($loginPage);
        return $result;
    }
protected function safeReloadWithTokens ( HTTPRequest $ request , ConfirmationTokenChain $ confirmationTokenChain ) { // Safe reload requires manual boot $ this -> getApplication ( ) -> getKernel ( ) -> boot ( false ) ; // Ensure session is started $ request -> getSession ( ) -> init ( $ request ) ; // Request with ErrorDirector $ result = ErrorDirector :: singleton ( ) -> handleRequestWithTokenChain ( $ request , $ confirmationTokenChain , $ this -> getApplication ( ) -> getKernel ( ) ) ; if ( $ result ) { return $ result ; } // Fail and redirect the user to the login page $ params = array_merge ( $ request -> getVars ( ) , $ confirmationTokenChain -> params ( false ) ) ; $ backURL = $ confirmationTokenChain -> getRedirectUrlBase ( ) . '?' . http_build_query ( $ params ) ; $ loginPage = Director :: absoluteURL ( Security :: config ( ) -> get ( 'login_url' ) ) ; $ loginPage .= "?BackURL=" . urlencode ( $ backURL ) ; $ result = new HTTPResponse ( ) ; $ result -> redirect ( $ loginPage ) ; return $ result ; }
Reload application with the given token, but only if either the user is authenticated,
or authentication is impossible.

@param HTTPRequest $request
@param ConfirmationTokenChain $confirmationTokenChain
@return HTTPResponse
Reload application with the given token but only if either the user is authenticated or authentication is impossible .