Forum

Accueil » Liferay Portal » English » 3. Development

Vue combinée Vue Plate Arborescence
Sujets [ Précédent | Suivant ]
toggle
Traolly Xiong
Redirect guest user to the current page after login
25 août 2014 18:38
Réponse

Traolly Xiong

Rang: Regular Member

Publications: 115

Date d'inscription: 30 décembre 2011

Publications Récentes

Hello ,
I'm trying to redirect the guest user back to the current page after login via the "login.jsp" hook. Is that the best approach or there
a better approach?

Any direction is much appreciated.

Thanks.
Pankaj Kathiriya
RE: Redirect guest user to the current page after login
25 août 2014 19:03
Réponse

Pankaj Kathiriya

Rang: Liferay Master

Publications: 664

Date d'inscription: 4 août 2010

Publications Récentes

Isnt this a default behaviour that user gets redirected to last visited page after login? Which liferay version are you using?
Suraj Bihari
RE: Redirect guest user to the current page after login
25 août 2014 22:55
Réponse

Suraj Bihari

Rang: Junior Member

Publications: 36

Date d'inscription: 20 décembre 2013

Publications Récentes

Hello Traolly,
There is a way to redirect the signed in user to the previous page:
https://www.liferay.com/community/forums/-/message_boards/message/8264376

HTH,
Suraj
Traolly Xiong
RE: Redirect guest user to the current page after login
10 septembre 2014 13:18
Réponse

Traolly Xiong

Rang: Regular Member

Publications: 115

Date d'inscription: 30 décembre 2011

Publications Récentes

I will try this out.... But in a nutshell what I am trying to accomplish is:

1) Hit a webapp URL (i.e. "/<plugin web app>/xyz")
2) Redirect to a secured page
3) Trigger login
4) After login, I want to redirect back to the #1) URL.

I've tried to create session variable of the URL, but some reason it loses it's value through the login process.

Any tips / tricks on how I can possibly accomplish this?

My workaround was, first hit a secure page, trigger some javascript and then redirect to #1) web app URL, and then redirect to #2) URL.

Thanks.
Suraj Bihari
RE: Redirect guest user to the current page after login
10 septembre 2014 23:34
Réponse

Suraj Bihari

Rang: Junior Member

Publications: 36

Date d'inscription: 20 décembre 2013

Publications Récentes

By default if you try to access a private page /group/secure-page , you will get redirected to a login page /web/home. After successful login you'll be redirected back to the private page /group/secure-page.

So creating a post login event (hook) will be sufficient.

HTH!
Suraj
Vishal M
RE: Redirect guest user to the current page after login
10 septembre 2014 23:35
Réponse

Vishal M

Rang: New Member

Publications: 14

Date d'inscription: 15 juillet 2014

Publications Récentes

This may help you

Create a theme and change portal_normal.vm
1)Check for logged in user using
#if ($is_signed_in)
-----------------------
------------------------
#else
show sign in portlet (portlet id 58)
#end
2) Apply this theme to your page.
Traolly Xiong
RE: Redirect guest user to the current page after login
2 octobre 2014 10:58
Réponse

Traolly Xiong

Rang: Regular Member

Publications: 115

Date d'inscription: 30 décembre 2011

Publications Récentes

Very interesting solutions. I've decided to secure a page and let it log in, and use js to redirect the user for my use case.
I'll definitely try the solutions mentioned if the use case is universal and / or make sense to.

Many thanks.
Suraj Bihari
RE: Redirect guest user to the current page after login
2 octobre 2014 15:05
Réponse

Suraj Bihari

Rang: Junior Member

Publications: 36

Date d'inscription: 20 décembre 2013

Publications Récentes

Enjoy Liferay!