Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Arvind Gupta
Login required for public paes
June 27, 2013 6:24 AM
Answer

Arvind Gupta

Rank: Junior Member

Posts: 29

Join Date: December 17, 2012

Recent Posts

I have public pages and for some public pages login is required, due some constraint we do not want to create private pages. Can someone help me how can we achieve this.
David H Nebinger
RE: Login required for public paes
June 27, 2013 7:11 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6130

Join Date: September 1, 2006

Recent Posts

Go to the page permissions and remove guest access. Login will be required to view them as a result.
Arvind Gupta
RE: Login required for public paes
June 27, 2013 10:38 PM
Answer

Arvind Gupta

Rank: Junior Member

Posts: 29

Join Date: December 17, 2012

Recent Posts

Thanks David,I tried already tried this but in this case the page will not come in the navigation, is their any other way.
Milen Dyankov
RE: Login required for public paes
June 28, 2013 2:11 AM
Answer

Milen Dyankov

LIFERAY STAFF

Rank: Regular Member

Posts: 219

Join Date: October 30, 2012

Recent Posts

Arvind Gupta
RE: Login required for public paes
June 28, 2013 5:28 AM
Answer

Arvind Gupta

Rank: Junior Member

Posts: 29

Join Date: December 17, 2012

Recent Posts

Hi Milen I tried the solution but after login it is taking me to home page instead of the page that i clicked on. Is their any other way that we can achive this.
Arvind Gupta
RE: Login required for public paes
July 1, 2013 3:35 AM
Answer

Arvind Gupta

Rank: Junior Member

Posts: 29

Join Date: December 17, 2012

Recent Posts

Please help me in this
Milen Dyankov
RE: Login required for public paes
July 1, 2013 3:50 AM
Answer

Milen Dyankov

LIFERAY STAFF

Rank: Regular Member

Posts: 219

Join Date: October 30, 2012

Recent Posts

Check the value of auth.forward.by.last.path

1    #
2    # Set this to true if users are forwarded to the last visited path upon
3    # successful login. If set to false, users will be forwarded to their
4    # default layout page.
5    #
6    auth.forward.by.last.path=true
Arvind Gupta
RE: Login required for public paes
July 3, 2013 4:56 AM
Answer

Arvind Gupta

Rank: Junior Member

Posts: 29

Join Date: December 17, 2012

Recent Posts

Thanks millen it is now forwarding to page, but now my problem is i want to take the user to my custom login page in such case and in other cases to liferay default login page, I tried auth.login.site.url=/web/portal/login but it is giving me below error;

You do not have the roles required to access this portlet.

Can you please help me on this
Arvind Gupta
RE: Login required for public paes
July 5, 2013 2:30 AM
Answer

Arvind Gupta

Rank: Junior Member

Posts: 29

Join Date: December 17, 2012

Recent Posts

can someone guide me on this i am stucked.
parikshit sharma
RE: Login required for public paes
July 5, 2013 5:31 AM
Answer

parikshit sharma

Rank: Junior Member

Posts: 47

Join Date: October 18, 2012

Recent Posts

Hi Arvind,
You can manage it through theme ,you can use init_custom.vm and redirect the user as per your requirement.
Arvind Gupta
RE: Login required for public paes
July 9, 2013 10:27 PM
Answer

Arvind Gupta

Rank: Junior Member

Posts: 29

Join Date: December 17, 2012

Recent Posts

Thanks for your reply John, I am new to liferay can give some example how to redirect from theme
parikshit sharma
RE: Login required for public paes
July 10, 2013 3:05 AM
Answer

parikshit sharma

Rank: Junior Member

Posts: 47

Join Date: October 18, 2012

Recent Posts

Hi Arvind,
You have done with forwarding part, that it will forward you to the page you want to show.And now you just want to redirect the user to your custom login page if he tried to access the page which need the authentication.For this flow I have created 2 pages noguest and guestlogin.
noguest page which will be available for the user after login and for login I have created custom page guestlogin and added the login portlet over it using theme. Now if you try to access my page (noguest) you will be redirected to the (guestlogin) page and after login ,it will take you the last path i.e. noguest page.

I have written the code in init_custom.vm.

1
2#set($currentURL=$theme_display.getURLCurrent())
3 #if(!$theme_display.isSignedIn())
4   #if($currentURL.indexOf("/noguest") !=-1)
5      <script>window.location="$themeDisplay.getURLPortal()/guestLogin";</script>
6   #end
7 #end
Arvind Gupta
RE: Login required for public paes
July 11, 2013 11:14 PM
Answer

Arvind Gupta

Rank: Junior Member

Posts: 29

Join Date: December 17, 2012

Recent Posts

Thanks John it worked for me