[SOLVED] Redirect to Diffrent domain after LogOut

Hi,

I Need to take the user to the diffrent domain(https://${domain}.com) once user gets the logout from the application(neos/logout).

Where should I write the code for same?

You can use the Signal/Slot and hook into

    /**
     * Signals that all active authentication tokens have been invalidated.
     * Note: the session will be destroyed after this signal has been emitted.
     *
     * @return void
     * @Flow\Signal
     */
    protected function emitLoggedOut(): void
    {
    }

Inside the AuthentionProviderManager class

Read about it here

https://flowframework.readthedocs.io/en/stable/TheDefinitiveGuide/PartIII/SignalsAndSlots.html

Really Thanks for reply.
I gone through the docs which you recommended.

But I don’t find any api or class which can help me redirect to "www.mydomain.com" inside that method which user click on logout icon.

Like if i talk about servlet api ,below code can be used
httpResponse.sendRedirect(“www.mydomain.com”)

Here though which class or function i can do that.

Please help me in that.

Thanks in advance.

Could anyone please
help on this?

Look at how the AbstractController does it, and copy that approach

https://neos.github.io/flow/5.1/source-class-Neos.Flow.Mvc.Controller.AbstractController.html#314-333

        $escapedUri = htmlentities($uri, ENT_QUOTES, 'utf-8');
        $this->response->setContent('<html><head><meta http-equiv="refresh" content="' . intval($delay) . ';url=' . $escapedUri . '"/></head></html>');
        $this->response->setStatus($statusCode);
        if ($delay === 0) {
            $this->response->setHeader('Location', (string)$uri);
        }
        throw new StopActionException();

In short, it’s about creating a new Response instance and fill the content with a redirect html. I know that other approaches has been discussed, but this is completely supported by all browsers :slight_smile:

Got the diffrent solution and it worked.
see the below code
In /Neos/Packages/Application/Neos.Neos/Classes/Controller/LoginController.php

public function logoutAction()
{
$possibleRedirectionUri = $this->backendRedirectionService->getAfterLogoutRedirectionUri($this->request);
parent::logoutAction();
switch ($this->request->getFormat()) {
case ‘json’:
$this->view->assign(‘value’, [‘success’ => true]);
break;
default:
if ($possibleRedirectionUri !== null) {
$this->redirectToUri(“https://dev.com/logout”);
}
$this->addFlashMessage(‘Successfully logged out’, ‘Logged out’, Message::SEVERITY_NOTICE, [], 1318421560);

    }
}

Thanks

If you change that directly in the controller, it wil be overridden when you update Neos - so I will not consider this a solution :slight_smile: