Changes between Version 1 and Version 2 of TrueHttpLogoutPatch
- Timestamp:
- Aug 17, 2006, 8:53:53 PM (18 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TrueHttpLogoutPatch
v1 v2 3 3 == Description == 4 4 5 This patch will allow to logout from Basic Auth.5 This patch allows to logout from Basic/Digest Auth without closing the browser. 6 6 7 On one hand Apache claims that it is not possible.8 On other hand, i've found a solution that workwith most recent browsers.7 On one hand Apache [http://httpd.apache.org/docs/1.3/howto/auth.html#basicfaq claims that it is not possible].[[BR]] 8 On other hand, Nano Documet [http://nanodocumet.homedns.org/rest/ give a solution] that works with most recent browsers. 9 9 10 This patch works for `tracd` standalone. There's no need of Apache or any other server. 10 11 11 == Bugs/Feature Requests == 12 I am lazy tonight, so i give you only the file changes.[[BR]] 13 This patch should work on all platform, although I've tested Windows only. 12 14 13 Existing bugs and feature requests for TrueHttpLogoutPatch are 14 [report:9?COMPONENT=TrueHttpLogoutPatch here]. 15 == Usage == 15 16 16 If you have any issues, create a 17 [http://trac-hacks.org/newticket?component=TrueHttpLogoutPatch&owner=flox new ticket]. 17 * first remove buggy AuthFormPlugin ;-) 18 18 19 == Download == 19 * file `Share\trac\htdocs\js\trac.js`, append at the end of file: 20 {{{ 21 function clearAuthenticationCache() { 22 try{ 23 var agt=navigator.userAgent.toLowerCase(); 24 if (agt.indexOf("msie") != -1) { 25 // IE clear HTTP Authentication 26 document.execCommand("ClearAuthenticationCache"); 27 } 28 else { 29 // Let's create an xmlhttp object 30 var xmlhttp = createXMLObject(); 31 // Let's get the force page to logout for mozilla 32 xmlhttp.open("GET",".force_logout_offer_login_mozilla",true,"logout","logout"); 33 // Let's send the request to the server 34 xmlhttp.send(""); 35 // Let's abort the request 36 xmlhttp.abort(); 37 } 38 // Let's redirect the user to the main webpage 39 // window.location = "/rest/"; 40 } catch(e) { 41 // There was an error 42 alert("there was an error"); 43 } 44 } 45 46 function createXMLObject() { 47 try { 48 if (window.XMLHttpRequest) { 49 xmlhttp = new XMLHttpRequest(); 50 } 51 // code for IE 52 else if (window.ActiveXObject) { 53 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 54 } 55 } catch (e) { 56 xmlhttp=false 57 } 58 return xmlhttp; 59 } 60 }}} 20 61 21 Download the zipped source from [download:truehttplogoutpatch here]. 62 * file `Lib\site-packages\trac\web\auth.py`, locate method `get_navigation_items`, and change: 63 {{{ 64 yield ('metanav', 'logout', 65 Markup('<a href="%s">Logout</a>' 66 % escape(self.env.href.logout()))) 67 }}} 68 to: 69 {{{ 70 yield ('metanav', 'logout', 71 Markup('<a href="%s" onclick="clearAuthenticationCache();return true;">Logout</a>' 72 % escape(self.env.href.logout()))) 73 }}} 22 74 23 == Source == 24 25 You can check out TrueHttpLogoutPatch from [http://trac-hacks.org/svn/truehttplogoutpatch here] using Subversion, or [source:truehttplogoutpatch browse the source] with Trac. 26 27 == Example == 28 29 Stay tuned. 75 * Now that's ok to start `tracd` and test logout feature. 30 76 31 77 == Recent Changes ==