eZ Platform Discussions

Custom logout URL from admin UI


#1

Hi

When logging out from admin GUI (in version 1.10) it looks like all eZ does is destroying the user session:

HTTP verb DELETE for URL https://host/api/ezp/v2/user/sessions/

How can I also make the browser go to https://host/logout?

Which is defined in app/config/routing.yml:

login:
path: /login
defaults: { _controller: ezpublish.security.controller:loginAction }
login_check:
path: /login_check
logout:
path: /logout


#2

I’ve updated to 1.12 and still the logout path does not seem to be used. Any suggestion how I can trigger this?


#3

I don’t think you can. eZ Platform UI is a SPA app which has its own way of handling sessions which can’t be modified.


#4

I managed to do a modification with a custom js added to the bottom of ezplatform/vendor/ezsystems/platform-ui-bundle/Resources/views/PlatformUI/shell.html.twig

https://pastebin.com/HDMDT6Sj

In short, the script searches for the “Log out” LI element, creates a clone from it (to remove alle eventlisteners) and replaces it with the clone. The clone is set up with a onclick eventlistener which sends the user til /logout.

I’m aware that this has to be put back into shell.html.twig after every ezplatform upgrade, but it is critical for us to be able to log out from OAUTH - not just destroying the symfony session.

Any comments/warnings about this solution?


#5

I don’t really know as I don’t have much experience with Platform UI :slight_smile: