How do I logout using DTML
How do I logout current user using DTML I used <dtml-call expr="acl_users.logout(REQUEST)"> but it didn't work and zope gave me this. Site Error An error was encountered while publishing this resource. Error Type: AttributeError Error Value: logout What did I do wrong?? --------------------------------- Yahoo! Mail Mobile Take Yahoo! Mail with you! Check email on your mobile phone.
Looks like your userfolder does not support a logout method as an inspection of the code would have established. In fact, the only logout method that appears to be supported is in the App manager for the ZMI. You may want to look at the code and adapt it for your purposes. On Wed, 11 May 2005, Allen Huang wrote:
How do I logout current user using DTML I used <dtml-call expr="acl_users.logout(REQUEST)"> but it didn't work and zope gave me this.
Site Error An error was encountered while publishing this resource.
Error Type: AttributeError Error Value: logout
What did I do wrong??
--------------------------------- Yahoo! Mail Mobile Take Yahoo! Mail with you! Check email on your mobile phone.
-- Dennis Allison * Computer Systems Laboratory * Gates 227 * Stanford University * Stanford CA 94305 * (650) 723-9213 * (650) 723-0033 fax * allison@shasta.stanford.edu * allison@sumeru.stanford.edu
How do I logout current user using DTML I used <dtml-call expr="acl_users.logout(REQUEST)"> but it didn't work and zope gave me this.
Site Error
An error was encountered while publishing this resource.
*Error Type: AttributeError* *Error Value: logout*
**
*What did I do wrong??* You didn't specify which user folder you are using and if, for example, you use it with CookieCrumbler or other pluggins. If you use CookieCrumbler, then you can expire the authentication cookies like this:
<dtml-call "REQUEST['RESPONSE'].expireCookie('__ac', path='/')"> <dtml-call "REQUEST['RESPONSE'].expireCookie('__ac', path='/')"> I think a redirect is also needed, but I'm not sure. If you aren't using CookieCrumbler, then you can try the method described here: http://zdp.zope.org/projects/zfaq/faq/General#973291635 Regards, Josef
Dear Allen, please post your replies to the newsgroup as well.
I tried both yours and the dtml-raise methods, but both of them didn't work. With yours I redirect myself out but I still logged in. With dtml-raise Unathorized, it popped out an password query box and kept ask me to input password for three time and went to an error page and I'm still logged in as well.
Did I do anything wrong??
The dtml-raise should work. I don't know why isn't workning for you. Perhaps you stored the password in the browser or something like that, try deleting the stored passwords. About the popup window and the error message, as Jens post in the other message you started, this is the normal behaviour and can't be avoided. One way I can think about solving this behaviour is storing a hidden input field like "go_to_logout", then check the request in the standard_error_message when an unauthorized exception occures and close the window with javascript if such variable is found. I know that zope can access the variables on the request after an error happens, but I'm not I'm not sure if this is going to work with an UnauthorisedException. For the second approach with the authorization cookies, you first have to make sure that you have installed CookieCrumbler and that you have created an instance of it. After doing this, the expiration cookies method should work. Once you install CookieCrumbler, you can modify the default login forms if you want. Regards, Josef
participants (3)
-
Allen Huang -
Dennis Allison -
Josef Meile