Monday, July 23, 2012

Custom Landing page using hook - Liferay 6.1


!!!! DOWNLOAD "OS4L Custom Landing Page Hook" from Liferay Market Place now !!!!






Update : Also check OS4L Custom Landing Page Hook for complete solution of Landing page.

Hi Guys,

I've seen so many question going around landing on custom page after user log in in Liferay based on Organization/Site membership. So today I am going to cover the same thing and show you how can we achieve the same.

We can achieve this using Liferay Hook. I am using Liferay 6.1 CE GA1 for creating hook. If you don't have source for Liferay 6.1 CE GA1, you can download it from the given link.

Now first thing is we need create hook. Refer my other blog regarding Create Liferay Hook using Liferay IDE if you have never used it before.
We'll create our custom Action class which will be executed after user logs in successfully.

Override portal.properties
- First we'll have to override portal.properties's login.events.post property.
- Open liferay-hook.xml using Liferay Hook Editor. Select Hook Configuration-->Portal Properties
- Check Customize Liferay Portal Properties and Create new portal.properties




- From Portal Properties Overrides, Add Portal Property
   Name - login.events.post
   Value - com.liferay.opensourceforlife.events.CustomLandingPageAction
- Save it.


Create CustomLandingPageAction
- Create CustomLandingPageAction class in com.liferay.opensourceforlife.events package.
- It extends com.liferay.portal.kernel.events.Action.
- Now main logic is we'll have to set LAST_PATH session attribute which holds the landing page path which  will be used after user logs in to Liferay. So just create your path on which you want user to land.

HttpSession session = request.getSession();
  session.setAttribute(WebKeys.LAST_PATH, new LastPath(
   StringPool.BLANK, path));


Organization landing path
- Use below function to get organization path which user is member of.

private String getOrganizationPath(User user, boolean includeLanguage)
 throws PortalException, SystemException {

 String organizationPath = StringPool.BLANK;
 List<Organization> userOrganizations = user.getOrganizations();
 String language = StringPool.BLANK;

 if (includeLanguage) {
     language = StringPool.SLASH + user.getLocale().getLanguage();
 }

 if ((userOrganizations != null) && !userOrganizations.isEmpty()) {
  String organizationFriendlyURL =
  userOrganizations.get(0).getGroup().getFriendlyURL();
  organizationPath = language + "/web" + organizationFriendlyURL;
 }

 return organizationPath;
}

- If you have change in requirement, you can modify it according.

Site Lading Path
Use below function to get site path which user is member of.

private String getSitePath(User user, boolean includeLanguage)
throws PortalException, SystemException {

 String sitePath = StringPool.BLANK;
 List<Group> userSites = getSites(user.getUserId());

 String language = StringPool.BLANK;

 if (includeLanguage) {
  language = StringPool.SLASH + user.getLocale().getLanguage();
 }

 if ((userSites != null) && !userSites.isEmpty()) {
  String siteFriendlyURL = userSites.get(0).getFriendlyURL();
  sitePath = language + "/web" + siteFriendlyURL;
 }
 return sitePath;
}
- If you have change in requirement, you can modify it according.
- You can download full source code and package war.

Downloads
To download the Source Code OR WAR, simply pay by add a tweet on Twitter or Facebook comment and let other know regarding this cool blog.
  • Source Code
         
  • War
         


Reference Blogs

I hope this will be helpful.

Please revert back if you find any issue or need any help.

Thanks & Regards,
Tejas Kanani

71 comments :

  1. I have used your tutorial in an answer here: http://stackoverflow.com/a/12068142/468763.

    Thanks for the nice explanation.

    ReplyDelete
  2. Thanks Prakash for appreciation. I am glad that it helped you somehow and others, who will follow your post on stackoverflow.

    ReplyDelete
    Replies
    1. Hi Tejas,
      I create your hook with NetBeans and i deployed it in my liferay 6.1,
      but it doesn't work!!
      If you can help me, I can send you my .war file to look where I'm wrong.
      Thanks,
      Luca

      Delete
    2. Sure. Send me your war.
      Are you getting any error in backhand ?

      Delete
  3. Hi Tejas, im looking a solution for a problem that i have, im using a hook named defaultlandingpage-hook by Tarkan Corak in liferay 6.1.10, the problem is that after I reset my password, the landing page its not my private page instead is the portal home page. Hope You can help me.

    ReplyDelete
    Replies
    1. Hi Emmanuel,
      Well, I am not quite sure about the logic written for this hook as I've not written it. But still if you provide more details like error logs, any recent changes made on this hook by yourself, etc, I can have look on it and might get the exact problem with you. Some points to check.
      - Are you getting error in backhand after resetting your password ?
      - Have you modified anything(code/properties) in this hook ? If yes, request you to share the war which you are currently using.
      - Is you private page accessible via browser using url ? Verify that.

      If you have any details on above point, revert back and I'll try to check if anything is creating any issue.

      Thanks,
      Tejas

      Delete
    2. Hi again Tejas.

      Ok you're right about you didn't write the hook, the log isnt writing errors, its just the behavior of the hook, so...

      - Yes i'm getting this behavior after reseting my password
      - I didn't modified the code of hook, and sure! the .war is at http://andaka.org/~dave/defaultlandingpage-hook.war
      - Yes my page its accesible via url in the browser

      also i wish to know if your hook redirect me to my private page after a password recovery.

      I appreciate your help, Tejas .

      Delete
    3. Hi Emmanuel,
      I've checked the logic of http://andaka.org/~dave/defaultlandingpage-hook.war and it has provided many options for redirection of landing page through properties.
      If you have fixed requirement to land on logged in user's private page, I can make it for you with some changes required in my hook.

      Delete
    4. Sent you modified war for private page landing page after user logs in. Please check your gmail Inbox.

      Delete
  4. Hi Tejas,

    I really appreciate your help, i've installed the war that you send me, but after I sign in,it just redirect me to the portal home page.

    ReplyDelete
    Replies
    1. Can you try once with different user ? Or may be create new user and try with that.
      Did you add any property related to this on portal-ext.properties ?
      Or set any configuration from Control Panel --> Portal Settings ?

      Delete
    2. Hi Tejas,

      I tested your hook again and it works, thank you!! the problem was the Default Landing Page at Portal Properties.

      p.d. Sorry for the late.

      Delete
  5. Hi Tejas,

    I have to customize my login page,Instated of email i want to change username field.
    Then i click submit,it refer my struts action username is available then go for my home page otherwise go for login page.Give me some idea for work this.

    ReplyDelete
  6. Hi Tejas,

    Just for asking you, how can modify the redirect after I recovery my password? I want to go to my private page instead the home page.

    ReplyDelete
    Replies
    1. Hi Emmanuel,

      Sorry for late reply. You can download the complete source of my hook from OSPL Git repository. For complete detail please visit my new blog.
      http://www.opensourceforlife.com/2012/11/ospl-custom-landing-page-hook.html

      I've included all the details over there include source location and packaged war download details.

      Thanks,
      Tejas

      Delete
  7. Hi Tejas

    Is it Possible to pass an object from ACTION(MVC)class in custom portlet to CUSTOMLANDINGPAGEACTION class..

    Regards
    Azar

    ReplyDelete
  8. Hi Mohammad,

    As CUSTOMLANDINGPAGEACTION class is login post event. It will be called once after user logs in. So not sure in between this flow if we are able to set any parameter from custom portlet. I've never tried this before. But still I'll look into this.

    If you have any specific requirement and share some more details on this, it will be helpful.

    Thanks,
    Tejas

    ReplyDelete
  9. Hi Tejas

    Thanks for your reply..i implemented login post event,as suggested in http://www.liferay.com/community/forums/-/message_boards/message/18446812
    But it effect my Default landing page also.So i'm thinking to pass one object to CustomLandingPageAction class, when i cal login portlet ,in my custom portlet and change path only if that object is exist

    Here i cal login portlet
    public void process(ActionRequest actionRequest,
    ActionResponse actionResponse) throws IOException, PortletException {
    if (actionRequest.getRemoteUser() == null) {
    ThemeDisplay themeDisplay = (ThemeDisplay) actionRequest
    .getAttribute(WebKeys.THEME_DISPLAY);
    actionResponse.sendRedirect(themeDisplay.getURLSignIn());

    }


    Thanks
    Azar

    ReplyDelete
  10. Hi Tejas

    We Can pass object between these two clases.here is the link http://www.liferay.com/community/forums/-/message_boards/message/7400272

    ReplyDelete
    Replies
    1. Thanks Mohammad Azaruddin, for sharing useful link. Its seems very useful.

      Delete
  11. Hi Tejas,

    We are created "CustomAutoLogin" Hook & "CustomLandingPage" Hook. We are using Liferay-6.1CE & webseal for SSO. If we are using individually both its working, but if we are using individual custom landing page not working.It is throwing error message like "Your request failed to complete".

    Please share your thoughts to resolve this issue.

    Thanks in advance.

    ReplyDelete
    Replies
    1. Hi Nagesh,

      It will be helpful if you can share error logs. And what is the configuration you've used for customlandingpage hook ?

      Thanks,
      Tejas

      Delete
    2. Actually we are using custom landing page for based on user role. I found one ticket in liferay issues

      "(LPS-26134) Default landing page problem with custom auto login"

      Can you tell me how add that patch to my bundle.

      Delete
    3. Hi Nagesh,

      Check if below issue updates is helpful for you.
      http://issues.liferay.com/browse/LPS-26133

      And as that issue fixed version is Liferay 6.2 CE M2. Modification for the same issue would be made in that version only.

      Thanks,
      Tejas

      Delete
  12. hi
    i ain't sure,
    after my liferay start running, i downloaded and installed "OS4L Custom Landing Page Hook" from the store.
    where can i config it? am i have to create a same name hook?
    thank you.

    ReplyDelete
  13. Hi vic,

    When you install "OS4L Custom Landing Page Hook" from Liferay Marketplace, by default it will come with pre-configured setting to take user to site's public page which he/she has member of.

    In case if you want to change it to some other settings, you have 2 ways to do it.

    1) Modify the settings directly in packaged war by opening it using winzip or any other tool. So just open "CustomLandingPage-hook-6.1.1.1.war". Navigate to CustomLandingPage-hook-6.1.1.1.war\WEB-INF\classes and open portal.properties and modify your desired setting in custom.landing.page.type property value. And deploy it by putting it to Liferay's deploy folder.

    2) You can download/fork the source code of it from Custom Landing Page Git Repository(https://github.com/OS4L/CustomLandingPage-Hook) and modify the code and build new war for your changes.

    I hope this will help. Still in case if you face any difficulty, please let me know. I'll glad to help you.

    Thanks,
    Tejas

    ReplyDelete
    Replies
    1. Dear sir

      thank you, i choose 2.

      after i use it, i found that if i use
      custom.landing.page.type=userPrivatePage

      it won't change.
      so i add some in CustomLandingPageUtil

      ........
      public static String getDisplayURL(final HttpServletRequest request, final boolean isPrivateLayout) throws PortalException, SystemException {
      String displayURL = StringPool.BLANK;
      Group group = GroupLocalServiceUtil.getUserGroup(PortalUtil.getCompanyId(request), PortalUtil.getUserId(request));
      int publicLayoutsPageCount = group.getPublicLayoutsPageCount();
      StringBundler sb = new StringBundler(CustomLandingPageConstant.FIVE);
      if (publicLayoutsPageCount > 0) {
      sb.append(PortalUtil.getPathMain());
      sb.append("/my_sites/view?groupId=");
      sb.append(group.getGroupId());
      if (isPrivateLayout) {
      sb.append("&privateLayout=1");
      } else {
      sb.append("&privateLayout=0");
      }
      displayURL = sb.toString();
      } else {
      sb.append(StringPool.SLASH);
      sb.append("user");
      sb.append(group.getFriendlyURL());
      sb.append(StringPool.SLASH);
      sb.append("home");
      displayURL = sb.toString();
      }
      return displayURL;
      }
      ........

      Delete
    2. Thanks Vic for pointing this out. I'll take a look at into this and make sure it will work with userPrivatePage as well.

      Thanks for your code. I appreciate your help.

      Many Thanks,
      Tejas

      Delete
  14. Vic,

    I've found the actual issue. When user logs in very first time, their public & private page doesn't exist and at that time if code tries to generate using "/my_sites/view?groupId", it's not working. So according to the code you've suggested, I've modified the code and now it looks fine and working as expected. Can you please take update from Git source from https://github.com/OS4L/CustomLandingPage-Hook/ which has the latest code and try your requirement with it.

    Let me know if you are still facing any issue. And Thanks a lot for your help.

    Thanks,
    Tejas

    ReplyDelete
    Replies
    1. Hi
      you are too kind, i should be the one thanking you for your share and support:)
      your code is beautiful, why you use abstract class but interface?

      Delete
    2. Actually when initially started developing this, I've some other way of implementing this along with many methods(abstract + general) inside abstract class. And eventually after re factoring code it keeps reducing and finally came down to only single abstract method inside abstract class. So it kept as it is. Interface can be used here either :)

      Delete
    3. Hi, I am newbie in Liferay. I have download your source code. It's deployed successfully.
      Now I have make a little bit changes in portal.properties file as follows --
      login.events.post=com.liferay.opensourceforlife.events.CustomLandingPageAction
      override.default.landing.page.path=true
      custom.landing.page.type=userPublicPage.

      My question is that I can test this hook. Can you please give me the steps.

      Delete
    4. Hi Ranadip,

      Thanks for showing interest in CustomLandingPageHook. If your hook is successfully deployed after making your changes "custom.landing.page.type=userPublicPage". You can see Hook is deployed successfully in tomcat logs. After this just sign out existing user and try to re login with same user(or you can use any other user). Once authentication completes it should take user to his/her public page with url somewhat like http://localhost:8080/web/ranadip/home.

      I hope this will answer your question. If still you are facing any issue. Feel free to revert back with you comment or you can mail me on admin@opensourceforlife.com.

      Thanks,
      Tejas

      Delete
    5. Thanks a lot Tejas for this quick solution. I will try this and let you know the result.

      Ranadip

      Delete
    6. Hi,

      I have create a page under Administrative privilege. But after re login Liferay is not working. It shows 'The page isn't redirecting properly'
      Even when I restart the server I have face the same problem.

      Delete
    7. Hmmm ... Have you modified any java code ? What changes you have made in portal.properties of hok?

      And what is the url where it's trying to go ? What is the url showing in address bar ?
      Once you set "custom.landing.page.type=userPublicPage" it will take user to his/her public home page which usually gets generated automatically after user logs in first time.

      And if this doesn't work, can you please try debugging the code and check what is the exact value of url ?

      Thanks,
      Tejas

      Delete
    8. Thanks Tejas. I will try this.

      Delete
  15. Hi Tejas, I am using liferay 6.1.1 GA2.When ever users update their password after clicking forgot password, liferay is going to public page rather than private page(Default landing page in my application). I think Emmanuel also faced the same problem and I saw your reply their. Could you please share same hook to me(gangadhar.phy@gmail.com), if possible.
    Thank you,
    Gangadhar

    ReplyDelete
    Replies
    1. Hi Gangadhar,

      If I am not getting you wrong, you want user to redirect on User's Private page after user update his password.

      Did you apply Custom Landing Page Hook on your Liferay instance ? If it's not working along with Custom Landing Page Hook, I'll need to look into this.

      Thanks,
      Tejas

      Delete
    2. Thanks for you quick response. Yes, even after applying custom landing page hook, there is no luck.

      FYI, here are the links that are getting generated
      forgot password link:
      http://localhost:8080/web/guest/what-we-do?p_p_id=58&p_p_lifecycle=0&p_p_state=maximized&p_p_mode=view&_58_struts_action=%2Flogin%2Fforgot_password

      Update password link which is mailed:
      http://localhost:8080/c/portal/update_password?p_l_id=10591&ticketKey=beaaaf02-4ac8-41d4-a3f6-438afa49255f

      Redirecting URL after updating password:
      http://localhost:8080/web/guest/what-we-do?p_p_id=58&p_p_lifecycle=0

      Default landing page:
      group/guest/workspace

      Delete
    3. Gangadhar,

      I'll need to look into this and need to check whether flow is coming to Landing Page hook action class properly after updating password.

      You can also verify the same by debugging the code, whether control is coming to Custom Landing Page Hook ?

      Thanks,
      Tejas

      Delete
    4. Hi Tejas,

      I have debugged it, control is not entering into landing page after updating the password. This hook is working perfectly except for this use case.

      Delete
    5. In that case need to find the flow to reach to landing page after updating the password. Will need to check on this to make it work with this scenario as well.

      Delete
  16. This comment has been removed by the author.

    ReplyDelete
  17. Hi Tejas,

    I have created auto login hook using liferay but I am getting following error:

    “ERROR [InstancePool] Unable to load auth.JdeAutoLogin with the portal class loader or the current context class loader

    java.lang.ClassNotFoundException: auth.JdeAutoLogin”

    I have below entry in portal-ext.properties file:



    com.liferay.portal.servlet.filters.autologin.AutoLoginFilter=true

    auto.login.hooks=auth.JdeAutoLogin

    I think something is wrong in my deployment. What I need to do so that liferay AutoLogin filter can load my JDEAutologin class.

    Exception call stack is:
    2013-07-17 04:18:58,117 ERROR [InstancePool] Unable to load auth.JdeAutoLogin with the portal class loader or the current context class loader
    java.lang.ClassNotFoundException: auth.JdeAutoLogin
    at weblogic.utils.classloaders.GenericClassLoader.findLocalClass(GenericClassLoader.java:297)
    at weblogic.utils.classloaders.GenericClassLoader.findClass(GenericClassLoader.java:270)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.findClass(ChangeAwareClassLoader.java:64)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at weblogic.utils.classloaders.GenericClassLoader.loadClass(GenericClassLoader.java:179)
    at weblogic.utils.classloaders.ChangeAwareClassLoader.loadClass(ChangeAwareClassLoader.java:43)
    at com.liferay.portal.kernel.util.InstancePool._get(InstancePool.java:99)
    at com.liferay.portal.kernel.util.InstancePool._get(InstancePool.java:66)
    at com.liferay.portal.kernel.util.InstancePool.get(InstancePool.java:44)
    at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.(AutoLoginFilter.java:97)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:357)
    at java.lang.Class.newInstance(Class.java:310)
    at weblogic.servlet.internal.WebComponentContributor.getNewInstance(WebComponentContributor.java:225)
    at weblogic.servlet.internal.WebComponentContributor.createFilterInstance(WebComponentContributor.java:257)
    at weblogic.servlet.internal.FilterManager.loadFilter(FilterManager.java:92)
    at weblogic.servlet.internal.FilterManager.preloadFilters(FilterManager.java:57)
    at weblogic.servlet.internal.WebAppServletContext.preloadResources(WebAppServletContext.java:1872)
    at weblogic.servlet.internal.WebAppServletContext.start(WebAppServletContext.java:3154)
    at weblogic.servlet.internal.WebAppModule.startContexts(WebAppModule.java:1518)
    at weblogic.servlet.internal.WebAppModule.start(WebAppModule.java:484)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.ScopedModuleDriver.start(ScopedModuleDriver.java:200)
    at weblogic.application.internal.flow.ModuleListenerInvoker.start(ModuleListenerInvoker.java:247)
    at weblogic.application.internal.flow.ModuleStateDriver$3.next(ModuleStateDriver.java:425)
    at weblogic.application.utils.StateMachineDriver.nextState(StateMachineDriver.java:52)
    at weblogic.application.internal.flow.ModuleStateDriver.start(ModuleStateDriver.java:119)
    at weblogic.application.internal.flow.StartModulesFlow.activate(StartModulesFlow.java:27)
    at weblogic.application.internal.BaseDeployment$2.next(BaseDeployment.java:671)

    ReplyDelete
    Replies
    1. Hi Shobhit,
      Which version of liferay are you using ? From the logs it looks like you are using weblogic.
      If you feel comfortable, can you please share your hook code to identify the issue faster ?

      Thanks,
      Tejas

      Delete
    2. Hi Tejas,

      I am integrating my application with oracle Endeca 3.0 and it uses a liferay 5.2.
      This is my test code for silent login in endeca studio:

      public class JdeAutoLogin implements AutoLogin {
      public String[] login(HttpServletRequest req, HttpServletResponse res) throws
      AutoLoginException {
      try {
      User user = UserLocalServiceUtil.getUserByScreenName(companyId,
      screenName);
      credentials[0] = String.valueOf(user.getUserId());
      credentials[1] = user.getPassword();
      credentials[2] = Boolean.TRUE.toString();
      return credentials;
      } catch (NoSuchUserException e) {

      User createdUser = UserLocalServiceUtil.addUser(creatorUserId,
      companyId, autoPassword, password1, password2,
      autoScreenName, screenName, emailAddress,0 ,openId,
      locale, firstName, middleName, lastName, prefixId,
      suffixId, male, birthdayMonth, birthdayDay,
      birthdayYear, jobTitle, groupIds, organizationIds,
      roleIds, userGroupIds, sendEmail,
      new com.liferay.portal.service.ServiceContext());


      userId = createdUser.getUserId();
      credentials = new String[3];
      credentials[0] = String.valueOf(userId);
      credentials[1] = password1;
      credentials[2] = Boolean.FALSE.toString();
      logger.debug("UserId is " + userId);
      logger.debug("password1 is " + password1);
      return credentials;


      }

      I have created a war file with following structure:

      WEB-INF->classes/auth/JdeAutoLogin.class /portal.properties
      ->liferayhook.xml ->liferay-plugin-package.properties ->web.xml

      portal.properties file is having following entry:

      auto.login.hooks=auth.JdeAutoLogin
      auth.pipeline.enable.liferay.check=false

      Here is my liferay-hook.xml:

      portal.properties


      I deployed this war file in endeca's ear file(endeca-portal-weblogic-3.0.10089.ear) and add the following entry in portal-ext.properties

      com.liferay.portal.servlet.filters.autologin.AutoLoginFilter=true
      auto.login.hooks=auth.JdeAutoLogin
      auth.pipeline.enable.liferay.check=false

      So As per Document when I redirect to endica page it should create a user and show the welcome page but it is redirecting to login page. Kindly help me to figure out what I am doing wrong.


      Thanks
      Shobhit

      Delete
    3. Have you debugged the code ? Is it coming to your JdeAutoLogin ?

      Delete
  18. I can't debug the code as I deploy my application on web logic and I don't have IDE on that machien but I enabled the debug logs, I found one more error, error is not coming from my code, I think problem is that liferay is trying to load my class JDEAutoLogin but it is not able to find


    2013-07-20 03:24:19,455 DEBUG [AutoLoginFilter] class com.liferay.portal.servlet.filters.autologin.AutoLoginFilter is enabled
    2013-07-20 03:24:19,455 WARN [AutoLoginFilter] java.lang.NullPointerException
    java.lang.NullPointerException
    at com.liferay.portal.servlet.filters.autologin.AutoLoginFilter.processFilter(AutoLoginFilter.java:210)
    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:91)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:154)
    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:94)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:154)
    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:94)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:154)
    at com.liferay.portal.servlet.filters.virtualhost.VirtualHostFilter.doFilter(VirtualHostFilter.java:261)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:154)
    at com.liferay.portal.servlet.filters.threadlocalcache.ThreadLocalCacheFilter.processFilter(ThreadLocalCacheFilter.java:55)
    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:91)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at com.liferay.portal.kernel.servlet.BaseFilter.processFilter(BaseFilter.java:154)
    at com.liferay.portal.kernel.servlet.BaseFilter.doFilter(BaseFilter.java:94)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:738)
    at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
    at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
    at java.security.AccessController.doPrivileged(Native Method)

    ReplyDelete
  19. Hi Tejas

    I have work on the Liferay can you help me in the customization such a scenario is like a if user forgot the password they click on the forgot password link and they redirect on the page in this page Liferay only ask the email id and the value of the captured image

    My question is can I add the security question at that time for the user authentication and this security question is added at time of new user is added
    Any customization you know plz suggest me....

    ReplyDelete
  20. Hi I cannot deploy your Hook,
    It Shows

    "Error running SDK command compile
    java.lang.NullPointerException"

    Can you advice me to resolve this.

    Regards,
    Dinesh

    ReplyDelete
  21. Hi Dinesh,
    Can you provide below details that will help.
    - Which version of liferay are you using ?
    - Can you give complete error logs ?
    - From where you've downloaded the war ? Liferay Marketplace or from the give url in blog ? Or you can download the latest code from git from below url.
    https://github.com/opensourceforlife/CustomLandingPage-Hook/blob/master/maven/6.1.1CEGA2/CustomLandingPage-hook/Package/CustomLandingPage-hook-6.1.1.1.war?raw=true

    Thanks,
    Tejas

    ReplyDelete
  22. This comment has been removed by the author.

    ReplyDelete
  23. Hi Tejas,

    i have a problem with this hook. When i deploy it and my custom landing page is My private page(i define it in portal.prorpieties).

    It works only if in portal-ext.proprieties i set :

    layout.user.private.layouts.enabled=true
    layout.user.private.layouts.modifiable=true
    layout.user.private.layouts.auto.create=true

    layout.user.public.layouts.enabled=true //<--this work

    when i set portal-ext.proprieties :

    layout.user.private.layouts.enabled=true
    layout.user.private.layouts.modifiable=true
    layout.user.private.layouts.auto.create=true

    layout.user.public.layouts.enabled=false //<--this dont work

    Dont works and my landing page is the default page and not My private page.

    How i have a right landing page in my private page without see my public page in top bar?What is my mistake?




    ReplyDelete
    Replies
    1. Hi darkagnan,
      Sorry for late reply.

      Regarding your issue,
      As per your comments when we set "layout.user.public.layouts.enabled=false" in portal-ext.properties, user is not landed on their private page.
      Correct me If I am wrong here.

      I'll take a look at into this and try to reproduce the same and will work on it. I'll let you know the update once done with this.

      Thanks,
      Tejas

      Delete
    2. Hi Tejas,

      some news about my problems ?

      Thanks

      Delete
    3. Yes. It's in progress. Will let you know the updates very soon.

      Delete
    4. Hi darkagnan,
      I've spent some time to figure out the issue but when I've actually tried to reproduce the issue with the steps provided by you with modification of property "layout.user.public.layouts.enabled" to false.
      My current landing page setting is custom.landing.page.type=userPrivatePage in hook's portal.properties.
      When I've logged in it is perfectly taking me to my private page without any issue. Even I've tried by creating new user also and it also worked.

      Can you please let me know any particular steps to reproduce the issue you are facing ? Or please share your entire portal-ext.properties & hook's portal.properties from your liferay instance itself.
      This will help to identify the issue very fast, if any :)

      Waiting for your reply.

      Thanks,
      Tejas

      Delete
    5. This is my hook's portal.properties:
      login.events.post=com.liferay.opensourceforlife.events.CustomLandingPageAction

      ##
      ## Set override.default.landing.page.path to true if you want this property be override
      ## by CustomLandingPage path. If this is not provided by default it will take its value
      ## as true. And if this is set to false, CustomLandingPage hook will redirect to this page
      ## only. It needs to be true in case of Custom Landing page to work.
      ##
      override.default.landing.page.path=true

      ##
      ## Set this property as per your needs for landing page after user log in. It could be from one of
      ## the value from below options
      ## 1. userPrivatePage
      ## 2. userPublicPage
      ## 3. sitePublicPage
      ## 4. sitePrivatePage
      ## 5. organizationPublicPage
      ## 6. organizationPrivatePage
      ##
      custom.landing.page.type=userPrivatePage


      and this is my portal-ext.properties:(this work)

      layout.user.private.layouts.enabled=true
      layout.user.private.layouts.modifiable=true
      layout.user.private.layouts.auto.create=true
      layout.user.public.layouts.enabled=true <------when is true work
      default.user.private.layouts.lar=${liferay.home}/deploy/HOME2.lar
      my.places.show.community.private.sites.with.no.layouts=false




      and this is my portal-ext.properties:(the hook dont work)

      layout.user.private.layouts.enabled=true
      layout.user.private.layouts.modifiable=true
      layout.user.private.layouts.auto.create=true
      layout.user.public.layouts.enabled=false <------when is false and dont work
      default.user.private.layouts.lar=${liferay.home}/deploy/HOME2.lar
      my.places.show.community.private.sites.with.no.layouts=false

      Thanks,
      Sergio.

      if u need more detail ask to me

      Delete
    6. Which version of Liferay you are using ?
      As I am not getting any property "layout.user.private.layouts.modifiable" in Liferay 6.1's portal.properties.

      Delete
    7. My liferay version is Liferay Portal Community Edition 6.1.1 CE GA2

      yes it's obsolete probably was old code that follow me , i try to remove it

      and i say u the result

      Delete
    8. Thanks very much Tejas,

      it's work.The old code is very dangerous.

      sorry, and thanks u very much for help.

      Delete
    9. Uhhh !!! Finally :) !! Glad to hear that it got solved.
      Have a nice day !!

      Delete
    10. Sorry tejas,

      i m me again :). The solution dont work it again, but it's was only an illusion !

      So i take clean liferay installation and put hook again.

      The only row in my portal ext is :

      layout.user.public.layouts.enabled=false

      when i restart the server tomcat dont work again the custom landing page.



      But when i remove it, it work!

      i'm so sorry but this isnt the end :)

      Delete
  24. Strange !!! But I've just verified with Liferay 6.1.1 CE GA2 vanilla liferay with "layout.user.public.layouts.enabled=false" in portal-ext.properties. And created new user after modification & restart the server. But when I've logged in with the new user created, it took me to it's private home page.

    In order to find out the exact issue we might need to do a screen sharing session. If you are fine with it, can you share your contact details(or IM id) at admin@opensourceforlife.com ?

    - Tejas

    ReplyDelete
    Replies
    1. Thanks very much for your help ! now all work!

      Tejas is the best :)

      Delete
  25. Hi Tejas,

    I am integrating my application with liferay, I have created my Autologin plugin and it is working fine, I am redirecting from my application to liferay application with SSO, now I don't want show some option like (home,logout,control panel etc) in welcome page...
    Is it possible to do it for some users..........
    Your previous suggestion really helped me a lot.

    ReplyDelete
  26. Hi Tejas,

    Can you pls help me on my previous post??

    ReplyDelete
  27. Hi Shobhit,

    I am getting same exception "2013-07-17 04:18:58,117 ERROR [InstancePool] Unable to load auth.JdeAutoLogin with the portal class loader or the current context class loader"

    Can you tell me how you solved it?

    Thanks !!!

    ReplyDelete
  28. Hi Tejas, Many thanks for your portlet / efforts. We have a list of user groups / corresponding landing pages in our old 5.2 setup and want to use your portlet in 6.2... Is there a way to make a list and as soon as one instance applies, the user is redirected to that landing page...? Something like:

    UG Landing Page
    UMA /group/uma/home
    LAW /group/law
    etc.....

    Where as soon as it hits a UG the user is in it goes to that page. if all in list fail, go to /group/guest/home...

    Thank you

    ReplyDelete