[Zope] Redirect after login...

marc lindahl marc@bowery.com
Sat, 03 Nov 2001 15:26:52 -0500


Looking at the source for the CMF login_form.dtml (the source is the best
doc around...)  we have:

<!-- ****** Enable the automatic redirect ***** -->
<dtml-if name="HTTP_REFERER">
   <input type="hidden" name="came_from" value="<dtml-var
name="HTTP_REFERER">">
</dtml-if>
<!-- ****** Enable the automatic redirect ***** -->



...so that passes a hidden variable to the next form, logged_in.dtml:

<!-- ****** Enable the automatic redirect ***** -->
<dtml-if name="came_from">
  <dtml-call expr="RESPONSE.redirect(came_from)">
</dtml-if>
<!-- ****** Enable the automatic redirect ***** -->


which redirects you automatically to where they were before.  It's easy
enough to change the latter to get the member's homepage (look for what the
'my stuff' link in the actions box does), or to whatever custom stuff you're
dealing with (getting the user info from the acl_user or whatever).

P.S. if you're using CMF, you might want to post this stuff on
zope-cmf@zope.org list.

Marc

> From: Rob Foster <rob@thefosters.com>
> Date: Sat, 3 Nov 2001 12:48:36 -0700
> To: zope@zope.org
> Subject: [Zope] Redirect after login...
> 
> Here's what I've been trying to figure out:
> 
> When of my site's users authenticates, I'd like to immediately redirect
> them to their own home page in the system... In other words, upon
> becoming a member of the system, each user will have their own instance
> of a "member" class and upon authenticating, I want to forward them to
> the "View" view of their class.
> 
> Now, I know that CMF does this (sort of) but I haven't found enough
> documentation on CMF so I'm trying to do this with regular old zclasses,
> etc.
> 
> Any help would be greatly appreciated.
> 
> Thanks,
> Rob
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://lists.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
> http://lists.zope.org/mailman/listinfo/zope-announce
> http://lists.zope.org/mailman/listinfo/zope-dev )