Tribune

Home » Liferay Portal » English » 3. Development

Vista Combinata Vista Piatta Vista ad Albero
Discussioni [ Precedente | Successivo ]
toggle
redirect to the user's private page after login jacky hung 2 ottobre 2008 20.36
RE: redirect to the user's private page after login Tobias Amon 2 ottobre 2008 23.49
RE: redirect to the user's private page after login Mario Muñoz 3 ottobre 2008 1.25
RE: redirect to the user's private page after login Shamsul Bahrin 16 marzo 2009 2.20
RE: redirect to the user's private page after login Ali Shahrami 1 luglio 2010 10.34
RE: redirect to the user's private page after login Danny Francisco 28 settembre 2010 16.58
RE: redirect to the user's private page after login Rob Caljouw 18 agosto 2010 16.06
RE: redirect to the user's private page after login Danny Francisco 10 ottobre 2010 9.01
RE: redirect to the user's private page after login Rob Caljouw 10 ottobre 2010 9.31
RE: redirect to the user's private page after login Danny Francisco 11 ottobre 2010 6.29
RE: redirect to the user's private page after login Rob Caljouw 11 ottobre 2010 13.00
RE: redirect to the user's private page after login Danny Francisco 11 ottobre 2010 16.02
RE: redirect to the user's private page after login Rob Caljouw 11 ottobre 2010 19.28
RE: redirect to the user's private page after login Ali Shahrami 17 settembre 2010 7.50
RE: redirect to the user's private page after login Tomas Guido 24 novembre 2010 10.01
RE: redirect to the user's private page after login Praveen P 2 aprile 2012 2.12
RE: redirect to the user's private page after login Dhrutika Vyas 2 aprile 2012 5.58
RE: redirect to the user's private page after login Tejas Kanani 15 maggio 2013 2.35
jacky hung
redirect to the user's private page after login
2 ottobre 2008 20.36
Risposta

jacky hung

Punteggio: New Member

Messaggi: 8

Data di Iscrizione: 8 aprile 2008

Messaggi recenti

now, by default, the user is show wiith the guest page after login, i have to click the "My place" --> private to navigate to the user's private page. how can i redirect the user to his private page directly after login?

i know in 5.1.1. there is "default.landing.page.path" in properties file, but know can i pass the user name in the ulr?

like /user/jacky/home is the jacky's private page url,

so is there anything i can set like : default.landing.page.path=/user/{username}/home

thanks
Tobias Amon
RE: redirect to the user's private page after login
2 ottobre 2008 23.49
Risposta

Tobias Amon

Punteggio: Liferay Master

Messaggi: 549

Data di Iscrizione: 8 agosto 2007

Messaggi recenti

Hi,

it might work with the placeholder for the landing page. But I don't know the format.

Another way is to use the PostLoginAction which can be specified. Create a class extending the "Action" class.
In the "run" method you can put some code like this

1
2User user = req.getRemoteUser() // use liferay methods to get the user object having the userid from the "remoteUser"
3response.sendRedirect("/web/" + user.getUsername() + "/home");


that's it.

kind regards
Tobias
Mario Muñoz
RE: redirect to the user's private page after login
3 ottobre 2008 1.25
Risposta

Mario Muñoz

Punteggio: Junior Member

Messaggi: 43

Data di Iscrizione: 27 agosto 2007

Messaggi recenti

Hi,

The recommended way to achieve this behaviour is modifying (or create your own) com.liferay.portal.events.DefaultLandingPageAction class. There is a good tutorial in Liferay wiki here:

http://www.liferay.com/web/guest/community/wiki/-/wiki/Main/Customizing+the+default+page+after+login

You can get the user screenName (the parameter in the personal comunnity URL) with something like this:

1
2screenName = UserLocalServiceUtil.getUser(PortalUtil.getUserId(request)).getScreenName();


Hope this helps.

Mario.
Shamsul Bahrin
RE: redirect to the user's private page after login
16 marzo 2009 2.20
Risposta

Shamsul Bahrin

Punteggio: New Member

Messaggi: 1

Data di Iscrizione: 16 marzo 2009

Messaggi recenti

FIRST, write this java code:


package com.liferay.portal.events;

import com.liferay.portal.kernel.events.Action;
import com.liferay.portal.kernel.util.*;
import com.liferay.portal.struts.LastPath;
import com.liferay.portal.util.*;
import com.liferay.portal.service.*;
import java.util.*;
import javax.servlet.http.*;

public class DefaultLandingPageAction extends Action {

public void run(HttpServletRequest request, HttpServletResponse response) {
try {
String screenName = UserLocalServiceUtil.getUser(PortalUtil.getUserId(request)).getScreenName();
String path = "/web/" + screenName + "/home";
if (Validator.isNotNull(path)) {
LastPath lastPath = new LastPath(StringPool.BLANK, path, new HashMap<String, String[]>());
HttpSession session = request.getSession();
session.setAttribute(WebKeys.LAST_PATH, lastPath);
}
} catch ( Exception e ) {
e.printStackTrace();
}
}

}



THEN, in the portal-ext.properties, add this line:

login.events.post=com.liferay.portal.events.LoginPostAction,com.liferay.portal.events.DefaultLandingPageAction



DONE.....
Ali Shahrami
RE: redirect to the user's private page after login
1 luglio 2010 10.34
Risposta

Ali Shahrami

Punteggio: Junior Member

Messaggi: 52

Data di Iscrizione: 31 luglio 2009

Messaggi recenti

Shamsul Bahrin:

String screenName = UserLocalServiceUtil.getUser(PortalUtil.getUserId(request)).getScreenName();
String path = "/web/" + screenName + "/home";



This path does not send user to his/her private page. The other issue that I have with screenName is that in most cases, the screenName from User is different than the actual user's friendlyURL that I believe comes from group table.

I have updated the following settings in portal-ext.properties and user is redirected to the private page. Default values are set to "true" and I set them to "false".
#
# Set this to true if users are forwarded to the last visited path upon
# successful login. If set to false, users will be forwarded to their
# default layout page.
#
auth.forward.by.last.path=false

#
# The login page reads a redirect by a parameter named "redirect". If this
# property is set to true, then users will be redirected to the given
# redirect path upon successful login. If the user does not have permission
# to view that page, then the rule set by the property
# "auth.forward.by.last.path" will apply.
#
# You can set the redirect manually from another application, by appending
# the "redirect" parameter in a url that looks like this:
# /c/portal/login?redirect=%2Fgroup%2Femployees%2Fcalendar. This url will
# redirect the user to the path "/group/employees/calendar" upon successful
# login.
#
auth.forward.by.redirect=false
Danny Francisco
RE: redirect to the user's private page after login
28 settembre 2010 16.58
Risposta

Danny Francisco

Punteggio: New Member

Messaggi: 10

Data di Iscrizione: 12 dicembre 2008

Messaggi recenti

Hi Ali,

I tried your solution with 6.0.4. Still not redirecting to private page. What version of Liferay are you using ?
Rob Caljouw
RE: redirect to the user's private page after login
18 agosto 2010 16.06
Risposta

Rob Caljouw

Punteggio: New Member

Messaggi: 12

Data di Iscrizione: 3 giugno 2009

Messaggi recenti

Hi Danny,

I'm using Liferay 6.0.4 and setting the following:

auth.forward.by.last.path=false
auth.forward.by.redirect=false

worked for me as far as redirecting users to their private pages.

The problem I'm having is related to setting the virtual host. If the virtual host is set to localhost users are directed to their private page. When the virtual host is set to the domain name users are directed to <virtual-host-name>/home no matter what the auth.forward.* settings are.

If you, or anyone else, has any suggestions on how to direct users to their private page when the virtual host name is set I'd really appreciate hearing them.

Best regards.

RJC
Ali Shahrami
RE: redirect to the user's private page after login
17 settembre 2010 7.50
Risposta

Ali Shahrami

Punteggio: Junior Member

Messaggi: 52

Data di Iscrizione: 31 luglio 2009

Messaggi recenti

Danny Francisco:


I tried you solution with 6.0.4. Still not redirecting to private page. What version of Liferay are you using ?


This worked for me with Liferay 5.2.3
Danny Francisco
RE: redirect to the user's private page after login
10 ottobre 2010 9.01
Risposta

Danny Francisco

Punteggio: New Member

Messaggi: 10

Data di Iscrizione: 12 dicembre 2008

Messaggi recenti

Hi Rob,

I still couldn't solve this. Did you have any luck?

Best Regards,

Danny


Rob Caljouw:
Hi Danny,

I'm using Liferay 6.0.4 and setting the following:

auth.forward.by.last.path=false
auth.forward.by.redirect=false

worked for me as far as redirecting users to their private pages.

The problem I'm having is related to setting the virtual host. If the virtual host is set to localhost users are directed to their private page. When the virtual host is set to the domain name users are directed to <virtual-host-name>/home no matter what the auth.forward.* settings are.

If you, or anyone else, has any suggestions on how to direct users to their private page when the virtual host name is set I'd really appreciate hearing them.

Best regards.

RJC
Rob Caljouw
RE: redirect to the user's private page after login
10 ottobre 2010 9.31
Risposta

Rob Caljouw

Punteggio: New Member

Messaggi: 12

Data di Iscrizione: 3 giugno 2009

Messaggi recenti

Hi Danny,

I couldn't find any combination of settings that would work so I wrote a login hook to handle it.

Best regards.

RJC
Danny Francisco
RE: redirect to the user's private page after login
11 ottobre 2010 6.29
Risposta

Danny Francisco

Punteggio: New Member

Messaggi: 10

Data di Iscrizione: 12 dicembre 2008

Messaggi recenti

Hi Rob,

That is great. I have thinking about hooks. But don't know much about it. How did you do it? Maybe you can you give me some pointers? or keywords I can google. is it hooks and events?
I'm playing with it right now. no luck yet.
:-)

Regards,

Danny


Rob Caljouw:
Hi Danny,

I couldn't find any combination of settings that would work so I wrote a login hook to handle it.

Best regards.

RJC
Rob Caljouw
RE: redirect to the user's private page after login
11 ottobre 2010 13.00
Risposta

Rob Caljouw

Punteggio: New Member

Messaggi: 12

Data di Iscrizione: 3 giugno 2009

Messaggi recenti

Hi Danny,

the attached file contains the hook I created. It's pretty simplistic but it should get you started. It's a NetBeans project that includes everything you need and the dist folder contains a war file that should work.

If you have any questions please feel free to ask anytime.

Good luck.

RJC
Allegati: Login-hook.zip (1.102,1k)
Danny Francisco
RE: redirect to the user's private page after login
11 ottobre 2010 16.02
Risposta

Danny Francisco

Punteggio: New Member

Messaggi: 10

Data di Iscrizione: 12 dicembre 2008

Messaggi recenti

Hi Rob,

Thank you very much.

Best Regards,

Danny
Rob Caljouw
RE: redirect to the user's private page after login
11 ottobre 2010 19.28
Risposta

Rob Caljouw

Punteggio: New Member

Messaggi: 12

Data di Iscrizione: 3 giugno 2009

Messaggi recenti

Hi Danny,

i hope it is of some help to you. if you have any questions please don't hesitate to ask.

Best regards.

RJC.
Tomas Guido
RE: redirect to the user's private page after login
24 novembre 2010 10.01
Risposta

Tomas Guido

Punteggio: New Member

Messaggi: 3

Data di Iscrizione: 23 novembre 2010

Messaggi recenti

Hi, i'm following this topic,
i write the code Shamsul write, but i need to add this as another file
in order of don't chage the core files

i read this can be posible, writing the new class name en el properties file like this

login.events.post=com.liferay.portal.events.LoginPostAction,com.liferay.portal.events.CustomLandingPageAction

but i don't know where to put the new file, i try tomcat lib, inside the webapps folder but can't make it work

any help is welcome

edit: i'm using a liferay tomcat bundle

thanks
---------------------------
Update: i read a howto, create my own hook to set my own version of the file.
Praveen P
RE: redirect to the user's private page after login
2 aprile 2012 2.12
Risposta

Praveen P

Punteggio: Regular Member

Messaggi: 100

Data di Iscrizione: 20 febbraio 2012

Messaggi recenti

Hi Shamsul Bahrin
please let me know the path where i have to write this java code

Thanks
Dhrutika Vyas
RE: redirect to the user's private page after login
2 aprile 2012 5.58
Risposta

Dhrutika Vyas

Punteggio: Expert

Messaggi: 435

Data di Iscrizione: 9 febbraio 2009

Messaggi recenti

Hi,

You need to write this code in your CustomDefaultLandingPageAction.

You need to overwrite below property in portal-ext.properties.

This call the class CustomDefaultLandingPageAction.java, which is used to redirect user after login
login.events.post=com.liferay.portal.events.CustomDefaultLandingPageAction

Regards,
Dhrutika
Tejas Kanani
RE: redirect to the user's private page after login
15 maggio 2013 2.35
Risposta

Tejas Kanani

Punteggio: Liferay Master

Messaggi: 654

Data di Iscrizione: 6 gennaio 2009

Messaggi recenti

You can use Custom Landing Page Hook available in Liferay Marketplace for the same.
Including User's Private page it also provides other options to be redirected on after user logs in based on selected property value in portal.properties of hook.

1. userPrivatePage
2. userPublicPage
3. sitePublicPage
4. sitePrivatePage
5. organizationPublicPage
6. organizationPrivatePage

Thanks,
Tejas