Forum OpenACS Q&A: Help with registration

Collapse
Posted by ultra newb on
Hello,

I created a custom registration page for my site by copying and modifying register.tcl (I hope this was the right approach).

I seem to be able to "break" the page by registering a user, then using the back button and attempting to register another user. What happens is, it generates the same user_id that it just generated for the previous successful attempt, thus registration fails. Is this correct behavior? Why?

I guess what I expected to happen was for the user to be logged out, and then a unique user_id generated. At the top of the script, I tried to ensure this with an ad_user_logout (the only proc I could find with a name for what I wanted to do), but that doesn't seem to work (or, if it does, it still generates the non-unique id).

I have no idea if this is the same behavior as with an unmodified register.tcl, but I assume it is, as my version isn't heavily modified.

Any ideas or insights are appreciated - thanks.

Collapse
2: Re: Help with registration (response to 1)
Posted by Dave Bauer on
I am not sure which file register.tcl is.

In the latest OpenACS the code is in

packages/acs-subsite/www/register/user-new.tcl
packages/acs-subsite/lib/user-new.tcl

and it reassigns a new id on every request, and logs out before attempting to create a new user.

Collapse
3: Re: Help with registration (response to 2)
Posted by ultra newb on
Whoops, I changed the name to register.tcl, then forgot I changed it.

I used the code from packages/acs-subsite/lib/user-new.tcl.

Are you sure the log out and reassign new id is working correctly in the instance I cited? If so, I'll try to see if something I did broke the code, but upon looking at it, the changes I made are mostly superficial.

Thanks.

Collapse
4: Re: Help with registration (response to 3)
Posted by Dave Bauer on
If the page was cached by the browser it could cause this problem.

The page should not be cached, and be reloaded when you hit the back button.

Collapse
5: Re: Help with registration (response to 4)
Posted by ultra newb on
I guess it is being cached. It doesn't reload when I hit the back button, apparently.

I'm using the latest version of mozilla. Is there some specific setting I should be using to correct this problem?

Thanks.

Collapse
6: Re: Help with registration (response to 1)
Posted by ultra newb on
I solved the problem by putting the above code at the top of the script. I'm posting it in case someone else has the same issue:

if {[ad_conn user_id]} {
ad_user_logout
ad_returnredirect register
ad_script_abort
}

Collapse
7: Re: Help with registration (response to 6)
Posted by ultra newb on
Substitute the name of your own register script with "register" above.