Fórumok

Custom login action redirect

thumbnail
Willem Vermeer, módosítva 8 év-val korábban

Custom login action redirect

Junior Member Bejegyzések: 32 Csatlakozás dátuma: 2012.03.30. Legújabb bejegyzések
Hi everybody,

My question in one line: how can I send a user to a custom landing page even when they log on by first accessing a random private page??

Detailed question:
I'm trying to redirect our users to a private site directly after login. To this end I have implemented my own Action class based on DefaultLandingPageAction. When the user first goes to /c/portal/login and logs on, the redirect to their private page works just fine.

However, when the user logs on by accessing another private page, my custom redirect is somehow overruled. Suppose we send the user to /group/restricted which is a private page. Liferay determines that the user should log on. After log on, I can see in the logs that we pass through my custom redirect, but we end up on /group/restricted nevertheless.
It looks like my LAST_PATH which I store in the http session is somehow overruled but how and where and why?

Has anybody ever encountered this use case?

Thanks,
Willem
thumbnail
Jan Geißler, módosítva 8 év-val korábban

RE: Custom login action redirect

Liferay Master Bejegyzések: 735 Csatlakozás dátuma: 2011.07.05. Legújabb bejegyzések
This seems rather strange, as the DefaultLandingPageAction should be called at last. So anything defined there should be executed.
Did you try and debug the stuff on your developer machine? Like, set a Break Point in your class, and then step through all methods to see where it could get overwritten?
thumbnail
David H Nebinger, módosítva 8 év-val korábban

RE: Custom login action redirect (Válasz)

Liferay Legend Bejegyzések: 14919 Csatlakozás dátuma: 2006.09.02. Legújabb bejegyzések
Willem Vermeer:
when the user logs on by accessing another private page, my custom redirect is somehow overruled.


It's not overruled, it's simply ignored.

When Liferay intercepts a request to a protected resource, it redirects to the login and sets a special "redirect" parameter. Upon successful login, Liferay uses this redirect parameter to send the user back to the protected resource they were originally looking for. This allows for things such as email links or protected file downloads to work.

Now you could, of course, mask out the redirect to stop Liferay from redirecting back there after successful login. I don't see how you would pass it so that it gets to your private page and again redirects from there to the protected resource, ...
thumbnail
Willem Vermeer, módosítva 8 év-val korábban

RE: Custom login action redirect

Junior Member Bejegyzések: 32 Csatlakozás dátuma: 2012.03.30. Legújabb bejegyzések
Thanks, this explains why it's not working :-)
I guess my usage of a private resource to redirect a user to the login page is not the way to go. That's fine.
Thanks,
Willem