Foren

Auto redirect to welcome page if user already logged in

Sign Shah, geändert vor 7 Jahren.

Auto redirect to welcome page if user already logged in

New Member Beiträge: 6 Beitrittsdatum: 31.03.16 Neueste Beiträge
I have developed a portlet in Liferay using JSF. As I don't want to use LifeRay login, I have my own login portlet deployed in liferay.

Now the problem is after login whenever I refresh page it again go back to the login portlet which is login.xhtml. My LoginBean is in session scope. How can I send user automatically to the welcome page if he is already logged in?

I tried to use the below thing but it doesn't work. Even no error. But it shows login page again. I also tried to call a action while page loading during login page load and run the below code but it is running successfully but not redirecting to the welcome page.

FacesContext fc = FacesContext.getCurrentInstance();
NavigationHandler navigationHandler = fc.getApplication().getNavigationHandler();
navigationHandler.handleNavigation(fc, null, "welcome");
fc.renderResponse();


I have navigation rule in the faces-config.xml (Liferay 6.2)

Thank you...
thumbnail
Philip White, geändert vor 7 Jahren.

RE: Auto redirect to welcome page if user already logged in (Antwort)

Junior Member Beiträge: 76 Beitrittsdatum: 11.03.15 Neueste Beiträge
Hi Sign Shah,

Please look at our jsf2-login-portlet demo.

A binary version can be downloaded here.

Regarding your question about navigation, we have a "You are signed in as ..." type of feature using Facelet's JSTL.

Finally, this only works on Liferay 6.2 + Tomcat 7.

Hope this helps!

Phil
thumbnail
Neil Griffin, geändert vor 7 Jahren.

Moved to Liferay Faces - English

Liferay Legend Beiträge: 2655 Beitrittsdatum: 27.07.05 Neueste Beiträge
Moved to Liferay Faces - English