Forum OpenACS Development: Re: HEAD redirect to registration behavior is different/broken

I'm not certain where the problem is, but the basic functionality as it existed still doesn't work. Here's how to see what I'm describing:
  1. logout from the site
  2. browse to some page that requires a registered user by entering the url directly into the browser address field
  3. when presented with the login page, enter an unknown set of credentials
  4. the login form will be re-displayed with an error indication
  5. click the Register link and complete your registration
  6. upon registration completion, you should (old behavior) be redirected to the page that was initially requested (above).
As you should see, you'll land at the new user's /pvt space and the initial page request is lost.

This functionality is important because it allows an unregistered user to follow a link provided to him (say) in an email (invitation) message, register, and land on a page that requires that the requester be registered.

In fact, it would be much smoother if the requester did not have to click the Register link but was instead guided directly to the new registration page (as it has worked in previous releases). Anything to smooth the way for the unitiated is good IMO.

This message is also included as a comment to the bug I filed a few days back.

Lars: fresh HEAD checkout ~7 PM PST Saturday...

(a few messages have been exchanged through the bug tracker's "comment" mechanism, but I would like to continue the discussion here since the problem resolution may benefit others searching through the forums. When it's resolved, I'll summarize to the open bug.)

I've whittled the code down to the minimum required to illustrate the problem. The following used to work under both 4.x and 5.x. I turned debug off to make logging clearer.

The following short script goes into the /www/register/ directory.

# This is a minimal illustration of the problem:
# the second ns_log is never reached.

set p "user-join-custom"

ns_log notice "$p: before ad_maybe_redirect_for_registration"
ns_log notice "$p: after ad_maybe_redirect_for_registration"

# more stuff...

Now, do the following:

  1. logout
  2. request http://yourserver/register/user-join-custom?group_id=552&invitation_code=1 (url vars to illustrate what I'm trying to accomplish)
  3. login as some existing user, or go ahead and register new. The failure occurs either way. I need it to work under both conditions.
  4. after login, you will land in /pvt/home
  5. check your server error log for the ns_log entries and you'll see that the first one appears. The second one doesn't.
Here's what my log shows:
[18/Oct/2003:20:51:04][20583.1080589904][-conn3-] Notice: ns_getform using encoding iso8859-1 for charset iso-8859-1
[18/Oct/2003:20:51:04][20583.1080589904][-conn3-] Notice: user-join-custom: before ad_maybe_redirect_for_registration
[18/Oct/2003:20:51:18][20583.1081093712][-conn4-] Notice: ns_getform using encoding iso8859-1 for charset iso-8859-1
[18/Oct/2003:20:55:59][20583.1074716240][-sched-] Notice: Swept developer support information for 0 requests (103 nsv elements)