Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Jubril Adisa
Liferay Navigation
July 5, 2012 1:34 PM
Answer

Jubril Adisa

Rank: Junior Member

Posts: 35

Join Date: February 9, 2012

Recent Posts

I have two pages Page1 and Page2, A user needs to be redirected to Page1 if they are not logged in (Page 1 contains the login Portlet) and should be redirected to Page 2 if they are logged in, Please how do i accomplish this
David H Nebinger
RE: Liferay Navigation
July 5, 2012 1:36 PM
Answer

David H Nebinger

Community Moderator

Rank: Liferay Legend

Posts: 8438

Join Date: September 1, 2006

Recent Posts

You don't do this.

You just create page 2 but remove guest access. When a guest tries to hit the page, they will be forced to log in.
Jack Bakker
RE: Liferay Navigation
July 5, 2012 1:59 PM
Answer

Jack Bakker

Rank: Liferay Master

Posts: 736

Join Date: January 3, 2010

Recent Posts

I gather you have one initial URL in mind

a login hook could redirect to another page if user already logged in
Jubril Adisa
RE: Liferay Navigation
July 5, 2012 3:28 PM
Answer

Jubril Adisa

Rank: Junior Member

Posts: 35

Join Date: February 9, 2012

Recent Posts

Jack Bakker:
I gather you have one initial URL in mind

a login hook could redirect to another page if user already logged in



Yes you are right i have one URL on my mind, Do you have a sample hook that can accomplish this
Jack Bakker
RE: Liferay Navigation
July 5, 2012 3:41 PM
Answer

Jack Bakker

Rank: Liferay Master

Posts: 736

Join Date: January 3, 2010

Recent Posts

if you create the hook and look at login.jsp, you will see the section on <c:when test="<%= themeDisplay.isSignedIn() %>">

in that you can do a javascript redirect with something like:

<script type="text/javascript">window.location = "/pageB";</script>

bit of a bounce effect for end user when u use Javascript for this, but if page is lightweight, not so bad
Jubril Adisa
RE: Liferay Navigation
July 5, 2012 3:52 PM
Answer

Jubril Adisa

Rank: Junior Member

Posts: 35

Join Date: February 9, 2012

Recent Posts

I am wondering if the solution can be like a Filter Hook/Ext to redirect a user


Thanks

Jubril
Jack Bakker
RE: Liferay Navigation
July 5, 2012 3:54 PM
Answer

Jack Bakker

Rank: Liferay Master

Posts: 736

Join Date: January 3, 2010

Recent Posts

also note David's recommendation

if the URL is to protected pageB and login required to access pageB, then after login redirect will go to pageB unless you have other funky (=non-default) stuff involved
Hitoshi Ozawa
RE: Liferay Navigation
July 5, 2012 4:51 PM
Answer

Hitoshi Ozawa

Rank: Liferay Legend

Posts: 7952

Join Date: March 23, 2010

Recent Posts

I too second David's recommendation. Liferay will automatically redirect user to a login page if they are not logged in. This is actually better than redirecting yourself because users will be returned to the page after they login.

I usually remove the login portlet from the home page.
Jubril Adisa
RE: Liferay Navigation
July 5, 2012 8:55 PM
Answer

Jubril Adisa

Rank: Junior Member

Posts: 35

Join Date: February 9, 2012

Recent Posts

Thanks All I will go with Daves Suggestion