Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Adam Victor Nazareth Brandizzi
Registering and logging in in one request for a custom portlet
April 30, 2012 5:53 PM

Adam Victor Nazareth Brandizzi

Rank: Junior Member

Posts: 67

Join Date: April 30, 2010

Recent Posts

Hello, all!

We have a custom portlet for user registration. To register a new user was relatively easy but we are struggling to make the recently registered user the logged in one just after its registration. We used UserLocalServiceUtil.authenticateByScreenName() but apparently it does not do all the magic. We longed for using the forbidden LoginUlti.login() method as well emoticon Currently, we are cogitating to send a request to the login action, but this seems to be a bit annoying to do...

How would you do it?

Thanks in advance!
Sandeep Nair
RE: Registering and logging in in one request for a custom portlet
April 30, 2012 9:50 PM

Sandeep Nair

Rank: Liferay Legend

Posts: 1732

Join Date: November 5, 2008

Recent Posts


I would use an auto login hook to automatically login after registration. Make username/userid available to the autologin hook class either using session or cookie after registration process is over

For a simple example of how AutoLoginHook class should be see RememberMeAutoLogin(this automatically logs in user if user has selected remember me checkbox while first time login. Just sets a cookie) or ParameterAutoLogin(This authenticates user if username and password are passed in request url).


Participate in the State of Liferay Community 2017. Help the community and even win some prizes!