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.

eZ debug

Timing: Jan 19 2025 12:42:21
Script start
Timing: Jan 19 2025 12:42:21
Module start 'layout'
Timing: Jan 19 2025 12:42:22
Module start 'content'
Timing: Jan 19 2025 12:42:22
Module end 'content'
Timing: Jan 19 2025 12:42:22
Script end

Main resources:

Total runtime0.7656 sec
Peak memory usage4,096.0000 KB
Database Queries83

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0070 589.1484152.6250
Module start 'layout' 0.00700.0041 741.773439.4453
Module start 'content' 0.01120.7529 781.2188689.9453
Module end 'content' 0.76410.0015 1,471.164124.1719
Script end 0.7656  1,495.3359 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.4992160.0002
Check MTime0.00150.1920160.0001
Mysql Total
Database connection0.00150.196210.0015
Mysqli_queries0.673787.9987830.0081
Looping result0.00080.1035810.0000
Template Total0.729195.220.3645
Template load0.00240.308820.0012
Template processing0.726794.915820.3633
Template load and register function0.00020.022110.0002
states
state_id_array0.00130.165110.0013
state_identifier_array0.00090.112020.0004
Override
Cache load0.00190.2540580.0000
Sytem overhead
Fetch class attribute can translate value0.00060.083230.0002
Fetch class attribute name0.00180.2354140.0001
XML
Image XML parsing0.00170.224930.0006
class_abstraction
Instantiating content class attribute0.00000.0056220.0000
General
dbfile0.00140.1770320.0000
String conversion0.00000.001340.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
11content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
11content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
16content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
2content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 45
 Number of unique templates used: 7

Time used to render debug report: 0.0001 secs