Redirect after login

Author Message

Marko Žmak

Tuesday 25 October 2005 12:36:24 pm

Is it possible to redirect after user login to a page like this:

/content/view/full/{$UserID}

I would like that every user, after it loogs in is redirected to his "homepage", the page with his user data.

I know it can be specified with:

<input type="hidden" name="RedirectURI" value="{$User:redirect_uri|wash}" />

but it seems that in this way I cannot redirect to user's details page.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Łukasz Serwatka

Wednesday 02 November 2005 1:07:36 am

Redirecting is possible, but if this will work depends where are your users folders placed. If user folder is placed in e.g content structure and it is availalbe for currently logged in user, then use main_node.node_id or main_node.url_alias and redirect after login using RedirectURI field.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Marko Žmak

Saturday 05 November 2005 3:35:02 pm

If I undesrtood you correctly I should use:

<input type="hidden" name="RedirectURI" value="{$User:main_node.url_alias|wash}" />

Is that correct?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Sunday 06 November 2005 2:13:14 pm

Also in what template override should I put this code?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Tuesday 08 November 2005 3:27:55 pm

I tired this but it doesnt work. has anyone actually succeed to redirect user to it's user details page after successfull login?

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Bruce Morrison

Tuesday 08 November 2005 4:02:28 pm

Hi Marko

I'm not sure you will be able to do this using RedirectURI. You would need to put the hidden RedirectURI form element into the login form. As you cannot know who the user will be <b>before</b> they login it is not possible to redirect them to a page specific to that user using this method.

It does appear that you will be able to do what you require in 3.8. Seehttp://pubsvn.ez.no/nextgen/trunk/doc/features/3.8/advanced_redirection_after_user_login.txt

HTH

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Marko Žmak

Wednesday 09 November 2005 12:13:06 am

Thx Bruce, this is exactly what I tought it will be the problem. I just tought that eZ already has a mechanisim for doing such thing. It seems I'll have to wait... :)

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Marko Žmak

Wednesday 09 November 2005 12:15:50 am

While we're waiting for the 3.8 version I came up with a quick fix for this:

Redirect user after login to a node with special template override in which I fetch the current user, and call the template that displays it's homepage. Should work just fine.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Łukasz Serwatka

Wednesday 09 November 2005 12:39:49 am

A little bit late, but ...

Bruce has right. Regarding to your idea:
Create dummy node, and put in template redirectoperator (check contrib section).

In login.tpl put

<input type="hidden" name="RedirectURI" value="/dummy_node" />

this will redirect user to dummy_node. In tpl for that dummy_node you can check user object and redirect to folder.

Personal website -> http://serwatka.net
Blog (about eZ Publish) -> http://serwatka.net/blog

Marko Žmak

Thursday 10 November 2005 3:11:48 pm

Yes Lukasz, that's exactly what I had in mind.

--
Nothing is impossible. Not if you can imagine it!

Hubert Farnsworth

Bruce Morrison

Thursday 10 November 2005 3:52:47 pm

Hi Lukasz

A great solution! Love "smoke & mirrors"!

On the redirect after login in 3.8, is there a reason that hooks for workflow triggers were not added to the user module to achieve this?

It would be a much more flexible solution, allowing for any type of redirection code to be added, and many other opportunities for login restrictions (logging of logins, time based restrictions, ip based restrictions, etc)

Cheers
Bruce

My Blog: http://www.stuffandcontent.com/
Follow me on twitter: http://twitter.com/brucemorrison
Consolidated eZ Publish Feed : http://friendfeed.com/rooms/ez-publish

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.