[Zope] CookieCrumbler: Login a user without a "login_form" Template

Nico Grubert nicogrubert at web.de
Sun Oct 12 11:42:24 EDT 2003

Hi there, 

I am using Cookie Crumbler to authenticate users in Zope. 
Am I right that Cookie Crumbler needs a "login_form" with fields 'username' 
and 'password' template to login users in Zope or is it possible to login a 
user in Zope without such a template, e.g. in an External Method ? 

In Zope, I have a folder containing: 
- cookie_authentication object 
- a simple Page Template "inputForm.html" with an input textfield 'qry' 
- an External Method "loginUser" 
- a "logged_in" Page Template the users sees if he is looged in successfully 
- an acl_users folder containing 1 user "testuser" (password: 123456, roles: 

The Page Template "inputForm.html" contains a submit button which calls the 
External Method "loginUser". 
In the External Method I want to login the currently anonymous user in Zope 
with username "testuser" and password "123456" (This user can be found in the 
acl_users folder). 

How can I do that? How do I need to modfify the REQUEST object to tell the 
Cookie Crumbler that the anonymous user now needs to be logged in? 

my External Method looks like this: 

def loginUser(self, REQUEST=None): 
"login a user into Zope" 
qry = REQUEST.get('qry', '') 
if qry == 'whatever': 
# login user "testuser" in Zope 
#... maybe something like ???: 
?REQUEST['__ac_name'] = 'testuser' 
?REQUEST['__ac_password'] = '123456' 
?return self.logged_in(REQUEST) 
# ... user not logged in 


Any idea how I can login the current anonymous user in Zope within this 
External Method? 

thanks in advance, 

Horoskop, Comics, VIPs, Wetter, Sport und Lotto im WEB.DE Screensaver1.2
Kostenlos downloaden: http://screensaver.web.de/?mc=021110

More information about the Zope mailing list