Forums

Home » Liferay Portal » English » 2. Using Liferay » General

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
sasmita swain
redirect public page to private site
April 7, 2013 10:37 PM
Answer

sasmita swain

Rank: Regular Member

Posts: 172

Join Date: February 24, 2012

Recent Posts

Hi

I am working on LR6.1 ga2..i have one login page and it is in public page.i have one more private site like http://localhost:8080/web/group/faulty..i want when i am login after submit it will redirect to private site.

how to do?

Thanks
Sasmita
Olaf Kock
RE: redirect public page to private site
April 8, 2013 12:21 AM
Answer

Olaf Kock

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1841

Join Date: September 23, 2008

Recent Posts

You'll have to configure the Default Landing Page. Googling this expression gives a lot of hints on how to override the default if you want it done programmatically

P.S. You'll probably get more/better answers if you post english questions to an english forum instead of a german language one.
dave ch
RE: redirect public page to private site
April 8, 2013 6:42 AM
Answer

dave ch

Rank: Regular Member

Posts: 164

Join Date: February 6, 2012

Recent Posts

Hi Sasmita,
There is already available hook for Custom Landing Page in marketplace.

Thanks,
Dave
Vilmos Papp
RE: redirect public page to private site
April 8, 2013 7:05 AM
Answer

Vilmos Papp

LIFERAY STAFF

Rank: Expert

Posts: 463

Join Date: October 21, 2010

Recent Posts

You can override the default DefaultLandingPageAction class and implement your business logic there:

 1protected void doRun(
 2            HttpServletRequest request, HttpServletResponse response)
 3        throws Exception {
 4
 5        long companyId = PortalUtil.getCompanyId(request);
 6
 7        String path = PrefsPropsUtil.getString(
 8            companyId, PropsKeys.DEFAULT_LANDING_PAGE_PATH);
 9
10        if (_log.isInfoEnabled()) {
11            _log.info(
12                PropsKeys.DEFAULT_LANDING_PAGE_PATH + StringPool.EQUAL + path);
13        }
14
15        if (Validator.isNotNull(path)) {
16            LastPath lastPath = new LastPath(StringPool.BLANK, path);
17
18            HttpSession session = request.getSession();
19
20            session.setAttribute(WebKeys.LAST_PATH, lastPath);
21        }
22
23        // The commented code shows how you can programmaticaly set the user's
24        // landing page. You can modify this class to utilize a custom algorithm
25        // for forwarding a user to his landing page. See the references to this
26        // class in portal.properties.
27
28        /*Map<String, String[]> params = new HashMap<String, String[]>();
29
30        params.put("p_l_id", new String[] {"1806"});
31
32        LastPath lastPath = new LastPath("/c", "/portal/layout", params);
33
34        session.setAttribute(WebKeys.LAST_PATH, lastPath);*/
35    }
sasmita swain
RE: redirect public page to private site
April 9, 2013 2:18 AM
Answer

sasmita swain

Rank: Regular Member

Posts: 172

Join Date: February 24, 2012

Recent Posts

Thanks for your reply
my code is:
@Override
public void run(HttpServletRequest request, HttpServletResponse response)
throws ActionException {


try {
HttpSession ses = request.getSession();

// To manually set a path for the user to forward to, edit
// portal.properties and set auth.forward.by.last.path to true.

Map params = new HashMap();

//params.put("p_l_id", new String[] {"PRI.3.1"});
params.put("p_l_id", new String[] {"PUB.1.1"});

LastPath lastPath = new LastPath("/c", "http://localhost:8080/group/guest/faculty", params);


ses.setAttribute(WebKeys.LAST_PATH, lastPath);
}
catch (Exception e) {
throw new ActionException(e);
}
when i am login by test test it is redirecting to localhost:web/faculty.. and it is showing not found this url.

can you tell me where i am doing wrong??

Thanks
Sasmita
Tejas Kanani
RE: redirect public page to private site
April 10, 2013 2:27 AM
Answer

Tejas Kanani

Rank: Liferay Master

Posts: 653

Join Date: January 6, 2009

Recent Posts

Hi Sasmita,

If you have common landing page for all the user to be redirected after login, you can set it from Control Panel itself.
Just go to Control Panel -> Portal -> Portal Settings -> Default Landing Page. Set value as "/web/group/faulty" in text box & save.

This will redirect each user to /web/group/faulty page after login. It doesn't matter which is you login page, so you could set any page as login page.

In case if you have any complex requirement like user should redirect to his/her public/private page or his/her site's/org's public/private page of which they are member off, then I would suggest to go with CustomLandingPage. Either you can code as per you requirement or you can also go with CustomLandingPageHook already available in Liferay Marketplace which does similar job for you without any coding effort is required.

I hope this will be helpful.

And also agree with Olaf, Please use English forum.

Thanks,
Tejas
Roshan Qureshi
RE: redirect public page to private site
April 10, 2013 2:20 AM
Answer

Roshan Qureshi

Rank: Regular Member

Posts: 143

Join Date: August 24, 2010

Recent Posts

Hi Sasmita,

By setting following properties you can do this.

default.landing.page.path=/web/group/faulty
auth.forward.by.last.path=true

But the user must be community member and have access to this page as a community member.

I hope this will work for you.

Thanks,
Roshan Qureshi
mohan kumar
RE: redirect public page to private site
May 10, 2013 2:36 AM
Answer

mohan kumar

Rank: New Member

Posts: 1

Join Date: May 10, 2013

Recent Posts

Hi Vilmos Papp,
I am very new liferay .so please help me where i replace this method and
how to create new portal for custom login to logou page ?
how to deploy that that application?
Advanced thanks for help
ugandhar @
RE: redirect public page to private site
June 24, 2013 12:16 AM
Answer

ugandhar @

Rank: Junior Member

Posts: 25

Join Date: November 21, 2011

Recent Posts

you can go through the below link.

http://www.liferay.com/community/forums/-/message_boards/message/22731875
Krzysztof Gołębiowski
RE: redirect public page to private site
August 13, 2013 5:54 AM
Answer

Krzysztof Gołębiowski

Rank: Expert

Posts: 379

Join Date: June 25, 2011

Recent Posts

I have the same configuration at one of our customer portals. I configured it using Liferay Virtual Hosts.

You have to:
  • Set virtual host domain name for your private pages (eq. private.example.com) and leave public pages blank
  • Create single public page containing login portlet
  • Add private pages as you wish


After entering private.example.com Liferay will display public login page first, and after logging in user will be automatically redirected to site private pages (according to virtual host configuration).

Regards,
KG
zeeshan aayan
RE: redirect public page to private site
September 3, 2013 4:59 AM
Answer

zeeshan aayan

Rank: New Member

Posts: 4

Join Date: September 3, 2013

Recent Posts

Thanks for sharing a great post