[Zope] Re: CookieCrumbler: Login a user without a "login_form"
Template
Nico Grubert
nicogrubert at web.de
Mon Oct 13 03:58:02 EDT 2003
hello jens,
well, I set the cookie in the RESPONSE like this:
---
def login_User(self, REQUEST=None):
"login"
req = REQUEST
resp = REQUEST.RESPONSE
name = 'testuser' # this user exists in acl_users
pw = '123'
ac = encodestring('%s:%s' % (name, pw))
req._auth = 'basic %s' % ac
resp._auth = 1
cookie_name = '__ac'
cookie_value = quote( ac )
resp.setCookie( cookie_name, cookie_value, path='/') # set the '__ac' auth cookie
pt = getattr(self, 'welcome') # get a page template
return pt(REQUEST)
---
The code is taken from CookieCrumbler (modifyRequest() method).
Unfortunately, this does not work. After I call this External Method I am still not logged in. I am redirected to: http://localhost:8080/testfolder/myZPT/login_form?came_from=...
Anything I missed?
> Look at how the CookieCrumbler sets the cookie and replicate that. A
> cookie that you set in a request will only be read *during the next
> request*.
______________________________________________________________________________
Die Besten ihrer Klasse! WEB.DE FreeMail (1,7) und WEB.DE Club (1,9) -
bei der Stiftung Warentest - ein Doppelsieg! http://f.web.de/?mc=021184
More information about the Zope
mailing list