« Torna a Configuring

Custom Portal Login Page

(Redirezionato da Customizing the portal login page)

By default when the user was in any place of the portal clicks the "Sign in" link he is shown an static portal login page (located at /c/portal/login). While it's possible to create your own customized login page using the available portlets, the user is not redirected to that page when clicking the "Sign in" button. This article explains how to change that in Liferay 5.0

Customizing the global portal page #

It is possible to let the portal know that a given page should act as the portal login page by setting a property in portal(-ext).properties with the property auth.login.url. For example to set the home page of the guest community:

 auth.login.url=/web/guest/home

After this value is set, every time a user clicks "Sign in" he will be redirected to the specified page. The portal will also use that page when an anonymous user tries to access a page that requires authentication and is to be redirected to the login page.

Using a different login page per community or organization #

Sometimes you want even more customization capabilities. In particular many people use Liferay's ability to have multiple communities (whenever I say community from now on, include organizations within the term) with separate websites and some users just know about one specific community. In this case it's often desired to keep the user within that community/organization to login instead of going to a portal wide page.

Starting with version 5.0 this is now possible in a very easy way. Just create a new page within the community and give it the friendly URL path /login That's it. The portal will detect that such a page exists and will use it as a login page when the user clicks sign in from within that community. Easy right?

The actual friendly URL path is configurable in portal(-ext).properties so you can change it to whatever you want:

 auth.login.community.url=/login

Note that for communities doesn't have such a page, the global login page configured in the previous section, or the default portal login page, will be automatically used instead.

Prior to 5.2.0 there has been limitation in this feature. When the user navigated to a page within the community that requires login, the old portal login would still be used. This was solved version 5.2.0. If you're operating an older version, take a look at LPS-342

Advanced #

Using your own login portlet #

Some advanced Liferay deployments include their own login portlet instead of the one bundled with Liferay. When this is done and the login page is customized as explained in this article the user will not be automatically redirected to the page where he was going to prior to login. Note that this only applies when the user is automatically redirected to the login page when trying to navigate to a protected page.

The reason is that the portlet doesn't have access to the redirect parameter that is used to signal the login portlet which page was the using trying to access to. The solution is to let the portal know which is the id of the custom login portlet so that it can make the redirect parameter available to it. This is done through a third property whose default value is:

auth.login.portlet.name

Conclusion #

That's it. This should cover all the needed cases in a quite easy way. Enjoy! :)

0 Allegati
135238 Visualizzazioni
Media (1 Voto)
La media del punteggio è 4.0 stelle su 5.
Commenti
Commenti Autore Data
Hi anyway has implemented own login portlet i... Hello Hello Hello 8 agosto 2008 2.47
How do you change the login itself? I want to... paul a adams 6 marzo 2009 15.29
Paul, This property should do it. # #... Amos Fong 11 marzo 2009 14.09
Hi, If one wishes to add more portlets or... Raja Nagendra Kumar 17 settembre 2009 5.29
Raja, Right now, I'm doing a login page. As... Anne D C 21 settembre 2009 3.49
How can I disable requirest of authentication... Marco Bolzan 24 settembre 2009 3.51
"...The portal will also use that page when an... Dan Grossen 12 maggio 2010 11.22
It seems such redirection occurs in 5.2.3 in... Alex . 14 luglio 2010 4.54
I set up a virtual host for the private pages... Matthew O Smith 8 dicembre 2010 15.13
I set auth.login.portlet.name=mylogin does't work lv yulin 27 ottobre 2010 2.45
Hi, I am trying to create a Custom Login Page... Piyush Khandelwal 30 dicembre 2012 23.14
Hi, I tried to look for a wiki version 6.1.1... Achmed Tyrannus Albab 25 febbraio 2013 2.17

Hi anyway has implemented own login portlet i want similar scenario
Inviato il 08/08/08 2.47.
How do you change the login itself? I want to use the screen name instead of the email. How would one do that?
Inviato il 06/03/09 15.29.
Paul,

This property should do it.

#
# The portal can authenticate users based on their email address, screen
# name, or user id.
#
#company.security.auth.type=emailAddress
company.security.auth.type=screenName
#company.security.auth.type=userId
Inviato il 11/03/09 14.09 in risposta a paul a adams.
Hi,

If one wishes to add more portlets or contents to the login page/register page (say some journal articles etc), how does one go about it.

I understand there must be some page id in which login portlet/register portlet would get rendered. How do identify such page id. May be if you could talk about these id's for standard portlets available for customization in extension environment, that would be nice value.

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com
Inviato il 17/09/09 5.29 in risposta a Amos Fong.
Raja,

Right now, I'm doing a login page. As far as I could understand, you want to make a "portlet" page with the login portlet and another portlet in it, right? If you make a new portlet page and named "login" (look in the URL friendly), you will be able to put journal content in it, as well as the login portlet. Then, Liferay will redirect you to that page where you will need to login.

Still, I'm unable to redirect the "sign in" URL...
I wish this would help (sorry, I'm not good writting in english).
Inviato il 21/09/09 3.49 in risposta a Raja Nagendra Kumar.
How can I disable requirest of authentication for example for blog page /web/mysite/blog?
I use social office 1.5b
Inviato il 24/09/09 3.51 in risposta a Anne D C.
"...The portal will also use that page when an anonymous user tries to access a page that requires authentication and is to be redirected to the login page."

I'm using 5.2.3 and it still users the /home page in this scenario
Inviato il 12/05/10 11.22.
It seems such redirection occurs in 5.2.3 in only case if virtual host is defined for the community
Inviato il 14/07/10 4.54 in risposta a Dan Grossen.
I set auth.login.portlet.name=mylogin does't work
Inviato il 27/10/10 2.45.
I set up a virtual host for the private pages and is still goes to /home with the default login page displayed.
Inviato il 08/12/10 15.13 in risposta a Alex ..
Hi,

I am trying to create a Custom Login Page which include following:
1)EmailAddress
2)Password
3)Captcha

I used Hook for this .
Captcha code is visible after adding code in Jsp.
But I am unable to validate this captcha on Sign In.

I extend LoginAction Class for writing the java code.

Thanks
Piyush
Inviato il 30/12/12 23.14.
Hi,

I tried to look for a wiki version 6.1.1 but couldn't find any.
So please excuse me if i'm in the wrong thread.

I have few sites under one portal, and have login pages created such as:
a.alpha.com/login
b.alpha.com/login
c.alpha.com/login
...

What i am trying to do here is to disallow members from c.alpha.com logging in cia a.alpha.com/login .

Currently the users from other sites can login at any of these /login pages eventhough they couldnt edit anything since i have set them roles restrictions.

I do not want to change my /login page name to something else if thats your suggestion.
I just need to block user from different Site to log in through other Site login page.

I hope i am clear enough.

Terima Kasih.
Inviato il 25/02/13 2.17.