[Zope] Logging out a user (in code)

Dieter Maurer dieter@handshake.de
Sun, 8 Jul 2001 23:50:42 +0200 (CEST)


Tommy Johnson writes:
 > ....
 >  but what I need to find out is how to
 > log the user out with code.(kill their session, whatever)
This depends whether you use "Basic Authentication" 
or "Cookie based Authentication".

In the former case, you can look how the Zope "logout" (--> ZMI)
works. It logs out, but it may well confuse your users.
Unfortunately, it is probably the best you can get with
Basic Authentication.

With cookie based authentication, you simply kill the cookie.

 > And I guess I can add another request while I'm thinking of it. Is there
 > (I'm sure there is) to determine if a user is logged in? Something like:
You check "AUTHENTICATED_USER.getUserName()" against
"Anonymous User".


Dieter