[Zope-CMF] Change login name on the fly

Antti Kaihola akaihola@ambitone.com
Fri, 18 Oct 2002 18:55:42 +0300


When a user wants to join my CMF site, she first gets a pre_join form=20
which only asks her name, converts it into lowercase, removes accents=20
from characters and replaces spaces and other special characters with=20
underlines. So for example "Jos=E9 McDonald" would become "jose_mcdonald"=
.=20
It then calls the real join_form where the user id is prefilled with the=20
generated string.

Now, I'd like to have the same mechanism when a user logs in. I'd like=20
it to be possible for the user to just type her name and make the system=20
figure out the login name on the fly. I figured that I probably need a=20
pre_logged_in script which modifies the request. I just can't get it to=20
work. I first tried to test the mechanism with something along these line=
s:

context.REQUEST.set('__ac_name', 'testlogin')
context.REQUEST.set('__ac_password', 'testpassword')
return context.logged_in(context, context,REQUEST)

Doesn't work although testlogin and testpassword should be valid.
I then tried to set properties of context.REQUEST.form instead. Doesn't=20
work.

Obviously the problem is that I really don't understand the inner=20
workings of Zope, CMF and the login mechanism. But shouldn't it be=20
possible to emulate the real login form with a script?


Antti Kaihola