Thursday, July 9, 2009

Customizing the Post Login in liferay

There are two ways to customize post login in the liferay
one method i explained in my recent blog
click here for link

The second method is concerd about all users who ever logins, shall be forwarded to his public page not to guest page,to by pass guest page

follow the following steps
1) Added below code to LoginAction.java : take this from the portal-src

After the code inside java class:

session.setAttribute ("j_username", userIdString);
session.setAttribute("j_password", user.getPassword());
session.setAttribute("j_remoteuser", userIdString);

Add:
session.setAttribute("j_userscreenname",user.getScreenName());

To store logged in users screen name in session, so that we can retrieve his information later.

File Path: com.liferay.portal.actions.LoginAction


2) Added below code to DefaultLandingPageAction.java:

File Path: com.liferay.portal.events/DefaultLandingPageAction

Compiled and added this file to portal-impl.jar file inside /ROOT/WEB-INF/LIB



HttpSession session = request.getSession();
String usercreenName = (String)session.getAttribute("j_userscreenname");

Map params = new HashMap();
LastPath lastPath = new LastPath("/web/", userscreenName+"/home/", params);

session.setAttribute(WebKeys.LAST_PATH, lastPath);


it worked for me..If it intrests you follow up........

No comments:

Post a Comment