Set a cookie just like the CookieCrumbler does. jens On Sunday, Oct 12, 2003, at 08:00 US/Eastern, nicogrubert@arcor.de wrote:
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: Manager)
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) else: # ... user not logged in
------------
Any idea how I can login the current anonymous user in Zope within this External Method?
thanks in advance, -nico
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )