In many Liferay’s applications , we need scenario like next :

  1. The registration  and login page is the home page
  2. When the user log in  is redirected to his private page.
  3. Then when the user log out  is redirected immediately to the login page.

This scenario is  not entirely  available  in Liferay, so we’ll need to add a Hook in order to get the desired result.

So Let’s start :

First, we add the following properties in portal-ext.properties

company.default.home.url=/c/portal/login
 default.logout.page.path=/c/portal/login

The company.default.home.url redirect the user to the default page, in this case we want that the home page is the log in page instead  of the guest page.

The second property default.logout.page.path is used when the user log out, the portal redirect it to the log in page.

Until now we have achieved two use cases from the three, the first and the third,

Remains the third one related to redirect the user after log in to his private page, Now we will use the following Hook CustomLandingPage, it’s  available in the marketplace after downloading and deploying the hook and under the directory path_to_portlet_contianer/CustomLandingPage-hook/WEB-INF/classes, in the portal.properties file, set up the the following property like next :

custom.landing.page.type=userPrivatePage.

I hope that post can be useful for everyone.