[Zope-CMF] Login from a script

Kari-Hans Kommonen khk@uiah.fi
Mon, 3 Feb 2003 12:42:39 +0200


hi!

I have a very simple question. I am trying to do a two step login but 
make it seem like only one step to the user.

I want to 1) ask for a username and a password, and 2) find the real 
userid from another source and 3) post the userid and the password to 
zope for authentication.

How do I do that POST from a script? GET or POST from the user seems 
to work, but I have not found a way to do it from a script. I am sure 
it is something very basic but I have not found an answer myself yet.

This is an example of what I have tried:

----

REQUEST= context.REQUEST

uname=REQUEST['username']
pw=REQUEST['password']
member=context.find_memberobject_by_string( uname )

if member != None:
   REQUEST.set('__ac_name', member.getId() )
   REQUEST.set('__ac_password', pw )
   return context.logged_in (context, REQUEST )

----


logged_in does not consider the __ac_name or __ac_password passed to 
it this way, it always results as unauthorized.



TIA, khk