Foren
customised landing page for login portlet [SOLVED]
lou cat, geändert vor 11 Jahren.
customised landing page for login portlet [SOLVED]
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste Beiträge
Hello!
I'd need to have a customised landing page for each user logged in my portal (well, not one different for every user, but maybe one different according to the role).
As far as I understood from this wiki:
http://www.liferay.com/community/wiki/-/wiki/Main/Customizing+the+default+page+after+login
I'll probably have to hook DefaultLandingPageAction.java (hoping this is valid for Liferay 6 too).
But before that I'd need to know:
1) why setting these properties in portal-ext.properties doesn't change my landing page after login:
auth.forward.by.last.path=true
default.landing.page.path= "my preferred path"
2) what's the exact difference between the login portlet and the built-in login?
If I change the portal properties related to login, will they both change?
At the moment after I login from the login portlet, I then see the same page and the portlet saying I'm logged in with my username...
If I login with the built-in portlet, it goes in the home page and not to the path I chose
Any contribute is much appreciated... thanks!!
I'd need to have a customised landing page for each user logged in my portal (well, not one different for every user, but maybe one different according to the role).
As far as I understood from this wiki:
http://www.liferay.com/community/wiki/-/wiki/Main/Customizing+the+default+page+after+login
I'll probably have to hook DefaultLandingPageAction.java (hoping this is valid for Liferay 6 too).
But before that I'd need to know:
1) why setting these properties in portal-ext.properties doesn't change my landing page after login:
auth.forward.by.last.path=true
default.landing.page.path= "my preferred path"
2) what's the exact difference between the login portlet and the built-in login?
If I change the portal properties related to login, will they both change?
At the moment after I login from the login portlet, I then see the same page and the portlet saying I'm logged in with my username...
If I login with the built-in portlet, it goes in the home page and not to the path I chose
Any contribute is much appreciated... thanks!!
Jignesh Vachhani, geändert vor 11 Jahren.
RE: customised landing page for login portlet
Liferay Master Beiträge: 803 Beitrittsdatum: 10.03.08 Neueste Beiträge
Hi Lou,
Please see the comment for you query.
1) why setting these properties in portal-ext.properties doesn't change my landing page after login:
auth.forward.by.last.path=true
Comment : 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.
default.landing.page.path= "my preferred path"
Comment: This is the page path where users are automatically redirected to after logging in.
2)what's the exact difference between the login portlet and the built-in login?
If I change the portal properties related to login, will they both change? Comment: Both are refering the same code internally so they will both change
At the moment after I login from the login portlet, I then see the same page and the portlet saying I'm logged in with my username...
If I login with the built-in portlet, it goes in the home page and not to the path I chose
Comment : this happens because your login portlet will be at landing page.
And for user wise landing, as suggested by liferay wiki ,you can write your login in DefaultLandingPageAction and can achieve the same functionality.
Please see the comment for you query.
1) why setting these properties in portal-ext.properties doesn't change my landing page after login:
auth.forward.by.last.path=true
Comment : 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.
default.landing.page.path= "my preferred path"
Comment: This is the page path where users are automatically redirected to after logging in.
2)what's the exact difference between the login portlet and the built-in login?
If I change the portal properties related to login, will they both change? Comment: Both are refering the same code internally so they will both change
At the moment after I login from the login portlet, I then see the same page and the portlet saying I'm logged in with my username...
If I login with the built-in portlet, it goes in the home page and not to the path I chose
Comment : this happens because your login portlet will be at landing page.
And for user wise landing, as suggested by liferay wiki ,you can write your login in DefaultLandingPageAction and can achieve the same functionality.
lou cat, geändert vor 11 Jahren.
RE: customised landing page for login portlet
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste Beiträge
Thank you Jinesh,
I set auth.forward.by.last.path property to false, but still I don't understand why
default.landing.page.path= "my preferred path" doesn't work.
At least now the login portlet redirects to the landing page, but it's still the normal home page while I set another path
My path points to a private page but I have access to that page, I thought it should redirect to the normal home page just if the logged in user doesn't have permission to view that page... I do!
I set auth.forward.by.last.path property to false, but still I don't understand why
default.landing.page.path= "my preferred path" doesn't work.
At least now the login portlet redirects to the landing page, but it's still the normal home page while I set another path
My path points to a private page but I have access to that page, I thought it should redirect to the normal home page just if the logged in user doesn't have permission to view that page... I do!
Daniel Aschauer, geändert vor 10 Jahren.
RE: customised landing page for login portlet
Junior Member Beiträge: 39 Beitrittsdatum: 22.10.12 Neueste BeiträgeAt the moment after I login from the login portlet, I then see the same page and the portlet saying I'm logged in with my username...
If I login with the built-in portlet, it goes in the home page and not to the path I chose
Comment : this happens because your login portlet will be at landing page.
That is exactly my problem. I am using the sign-in portlet, and i want to redirect to the last page.
I have set up auth.forward.by.last.path=true, but this will only bring my back to the same page (the page where i placed the sign-in portlet).
Is there a way to get to the last page that is not the login page?
lou cat, geändert vor 10 Jahren.
RE: customised landing page for login portlet
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste Beiträge
and what about
default.landing.page.path=
?
how did you set this property?
is it working as expected with the normal sign-in url (not the sign-in portlet)?
My portal uses a different landing page according to the user role/organization, so I guess our requirements are different...
default.landing.page.path=
?
how did you set this property?
is it working as expected with the normal sign-in url (not the sign-in portlet)?
My portal uses a different landing page according to the user role/organization, so I guess our requirements are different...
DarshanKumar N Bhatia, geändert vor 11 Jahren.
RE: customised landing page for login portlet
Junior Member Beiträge: 85 Beitrittsdatum: 02.03.10 Neueste Beiträgelou cat:
Hello!
I'd need to have a customised landing page for each user logged in my portal (well, not one different for every user, but maybe one different according to the role).
As far as I understood from this wiki:
http://www.liferay.com/community/wiki/-/wiki/Main/Customizing+the+default+page+after+login
I'll probably have to hook DefaultLandingPageAction.java (hoping this is valid for Liferay 6 too).
Yes u are right... U need to create Custom Login Hook :For Hook see : http://learntolead-liferay.blogspot.in/
lou cat:
But before that I'd need to know:
1) why setting these properties in portal-ext.properties doesn't change my landing page after login:
auth.forward.by.last.path=true
default.landing.page.path= "my preferred path"
As per Description from portal.properties files it should change.......
Are u getting any error.... ???
#
# 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=true
#
# Set the default landing page path for logged in users relative to the
# server path. This is the page users are automatically redirected to after
# logging in. For example, if you want the default landing page to be
# http://localhost:8080/web/guest/login, set this to /web/guest/login. To
# activate this feature, set auth.forward.by.last.path to true. To customize
# the behavior, see com.liferay.portal.events.DefaultLandingPageAction in
# the "login.events.post" property above.
#
default.landing.page.path=
#default.landing.page.path=/web/guest/login
lou cat:
.
2) what's the exact difference between the login portlet and the built-in login?
If I change the portal properties related to login, will they both change?
At the moment after I login from the login portlet, I then see the same page and the portlet saying I'm logged in with my username...
If I login with the built-in portlet, it goes in the home page and not to the path I chose
Any contribute is much appreciated... thanks!!
There is only one login portlet in Liferay called "Sign-in" which is available in tool category of Add Application menu.
Well I written my custom Hook to forward user to private/public page after login :
package com.liferay.custom.action;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import com.liferay.portal.kernel.events.Action;
import com.liferay.portal.kernel.events.ActionException;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.struts.LastPath;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.User;
import com.liferay.portal.util.PortalUtil;
import com.liferay.portal.kernel.util.WebKeys;
public class CustomPublicUserPagePostLoginAction extends Action{
@Override
public void run(HttpServletRequest httpsreq, HttpServletResponse httpsres)
throws ActionException {
/* Make sure auth.forward.by.last.path=true in portal.propertie file */
User user= null;
String username=null;
try {
user = PortalUtil.getUser(httpsreq);
username = user.getScreenName();
} catch (PortalException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (SystemException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
LastPath publiclastPath = new LastPath(StringPool.BLANK, "/web/"+username+"/home");
/* it gives user public page url :/web/test/home */
HttpSession session = httpsreq.getSession();
session.setAttribute(WebKeys.LAST_PATH, publiclastPath);
}
}
It get called whenever I login in Liferay.
HTH...
lou cat, geändert vor 11 Jahren.
RE: customised landing page for login portlet
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste BeiträgeDarshanKumar N Bhatia:
As per Description from portal.properties files it should change.......
Are u getting any error.... ???
no I don't see any error in the log, it just goes to the home page as it was the normal behaviour...
DarshanKumar N Bhatia:
There is only one login portlet in Liferay called "Sign-in" which is available in tool category of Add Application menu.
Yes, it's the one I'm using.
Thank you DarshanKumar!
Jignesh Vachhani, geändert vor 11 Jahren.
RE: customised landing page for login portlet
Liferay Master Beiträge: 803 Beitrittsdatum: 10.03.08 Neueste Beiträge
what you are providing in default.landing.page.path property ?
it should be in proper page URL format like /web/guest/home or web/guest/login and those page should be created.
it should be in proper page URL format like /web/guest/home or web/guest/login and those page should be created.
lou cat, geändert vor 11 Jahren.
RE: customised landing page for login portlet
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste Beiträge
I've tried with a couple of paths (pointing to existing pages of course!), also with public pages, even creating a /web/guest/login one...
but it always redirects to the usual home page
but it always redirects to the usual home page
Jignesh Vachhani, geändert vor 11 Jahren.
RE: customised landing page for login portlet
Liferay Master Beiträge: 803 Beitrittsdatum: 10.03.08 Neueste Beiträge
Please check what you have defined in your control panel portal settings .
Put your screenshots over here also which properties you are setting up.
Put your screenshots over here also which properties you are setting up.
lou cat, geändert vor 11 Jahren.
RE: customised landing page for login portlet
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste Beiträge
Hi Jignesh,
The portal settings for default landing page on the Control Panel are empty.
What properties do you want me to take a screenshot of?
The ones I can see from the Control Panel -> Server Administration -> Properties are a bit too many
Do you mean my portal-ext.properties?
thanks!
The portal settings for default landing page on the Control Panel are empty.
What properties do you want me to take a screenshot of?
The ones I can see from the Control Panel -> Server Administration -> Properties are a bit too many
Do you mean my portal-ext.properties?
thanks!
Jignesh Vachhani, geändert vor 11 Jahren.
RE: customised landing page for login portlet
Liferay Master Beiträge: 803 Beitrittsdatum: 10.03.08 Neueste Beiträge
Yes give details of portal-ext.properties.
I want to see Which properties you set their ?
I want to see Which properties you set their ?
lou cat, geändert vor 11 Jahren.
RE: customised landing page for login portlet
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste Beiträge
# CONFIGURATION OF POSTRESQL DATABASE
# PostgreSQL
jdbc.default.driverClassName=org.postgresql.Driver
jdbc.default.url=jdbc:postgresql://147.114.32.185:5432/LR_6_LF
jdbc.default.username=postgres
jdbc.default.password=coding
# CONNECTION POOL
#jdbc.default.jndi.name=jdbc/LiferayPool
# LIVE USERS
live.users.enabled=true
# DISABLING MY PUBLIC/PRIVATE PAGES FOR EVERY USER
layout.user.private.layouts.enabled=false
layout.user.private.layouts.modifiable=false
layout.user.private.layouts.auto.create=false
layout.user.public.layouts.enabled=false
layout.user.public.layouts.modifiable=false
layout.user.public.layouts.auto.create=false
# SETTINGS FOR THE LOCALE/LANGUAGE
locale.prepend.friendly.url.style=2
locales=en_US
locale.default.request=true
# DISABLING PERSISTENT COOKIES
session.enable.persistent.cookies=false
# DEFAULT LANDING PAGE
auth.forward.by.last.path=false
default.landing.page.path=/web/guest/login
# PostgreSQL
jdbc.default.driverClassName=org.postgresql.Driver
jdbc.default.url=jdbc:postgresql://147.114.32.185:5432/LR_6_LF
jdbc.default.username=postgres
jdbc.default.password=coding
# CONNECTION POOL
#jdbc.default.jndi.name=jdbc/LiferayPool
# LIVE USERS
live.users.enabled=true
# DISABLING MY PUBLIC/PRIVATE PAGES FOR EVERY USER
layout.user.private.layouts.enabled=false
layout.user.private.layouts.modifiable=false
layout.user.private.layouts.auto.create=false
layout.user.public.layouts.enabled=false
layout.user.public.layouts.modifiable=false
layout.user.public.layouts.auto.create=false
# SETTINGS FOR THE LOCALE/LANGUAGE
locale.prepend.friendly.url.style=2
locales=en_US
locale.default.request=true
# DISABLING PERSISTENT COOKIES
session.enable.persistent.cookies=false
# DEFAULT LANDING PAGE
auth.forward.by.last.path=false
default.landing.page.path=/web/guest/login
DarshanKumar N Bhatia, geändert vor 11 Jahren.
RE: customised landing page for login portlet
Junior Member Beiträge: 85 Beitrittsdatum: 02.03.10 Neueste Beiträge
Have u tried by Hook ??
lou cat, geändert vor 11 Jahren.
RE: customised landing page for login portlet
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste Beiträge
Well not yet, but I guess I'll have to
I was hoping to be able to use the built-in behaviour, at least at first.
I was hoping to be able to use the built-in behaviour, at least at first.
lou cat, geändert vor 11 Jahren.
RE: customised landing page for login portlet
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste Beiträge
I've created the hook but it doesn't work and I'm getting crazy
I got the correct URL for every user according to their role or organization, the problem is that the methods I've tried to set that url as the default landing page don't work.
I was trying to override the default page like this:
session.setAttribute(PropsKeys.DEFAULT_LANDING_PAGE_PATH, myURL);
my portal-ext.properties has:
auth.forward.by.last.path=false
default.landing.page.path=
but I've also tried differently and I've tried to modify lastPath variable too (as I've seen some examples that do that), using auth.forward.by.last.path=true,
but the behaviour gets even weirder 'cause instead of going to the home page as usual, it creates a strange url (baseURL+/en/c) that doesn't exist!
I guess it's just a question of setting the correct property but can someone help me with that?
I got the correct URL for every user according to their role or organization, the problem is that the methods I've tried to set that url as the default landing page don't work.
I was trying to override the default page like this:
session.setAttribute(PropsKeys.DEFAULT_LANDING_PAGE_PATH, myURL);
my portal-ext.properties has:
auth.forward.by.last.path=false
default.landing.page.path=
but I've also tried differently and I've tried to modify lastPath variable too (as I've seen some examples that do that), using auth.forward.by.last.path=true,
but the behaviour gets even weirder 'cause instead of going to the home page as usual, it creates a strange url (baseURL+/en/c) that doesn't exist!
I guess it's just a question of setting the correct property but can someone help me with that?
lou cat, geändert vor 11 Jahren.
RE: customised landing page for login portlet (Antwort)
Regular Member Beiträge: 196 Beitrittsdatum: 26.01.12 Neueste Beiträge
SOLVED
Eventually I didn't override DEFAULT_LANDING_PAGE_PATH, but I changed the lastPath using the property: auth.forward.by.last.path=true.
I also had to remove the baseURL from lastPath, it was redirecting to a funny page because of that.
Eventually I didn't override DEFAULT_LANDING_PAGE_PATH, but I changed the lastPath using the property: auth.forward.by.last.path=true.
I also had to remove the baseURL from lastPath, it was redirecting to a funny page because of that.