Fórum

Auto redirect to welcome page if user already logged in

Sign Shah, modificado 7 Anos atrás.

Auto redirect to welcome page if user already logged in

New Member Postagens: 6 Data de Entrada: 31/03/16 Postagens Recentes
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, modificado 7 Anos atrás.

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

Junior Member Postagens: 76 Data de Entrada: 11/03/15 Postagens Recentes
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, modificado 7 Anos atrás.

Moved to Liferay Faces - English

Liferay Legend Postagens: 2655 Data de Entrada: 27/07/05 Postagens Recentes
Moved to Liferay Faces - English