e2316d8ff89ed1beb085f9169c4c7ca344affb20 max Tue May 16 14:55:40 2017 -0700 Changes to hgLogin and hgSession to replace hgLogin with Apache's Basic authentication system, refs #19424, primarily motivated by CIRM but hopefully useful in other contexts diff --git src/hg/lib/logoutJs.h src/hg/lib/logoutJs.h new file mode 100644 index 0000000..7fe07c8 --- /dev/null +++ src/hg/lib/logoutJs.h @@ -0,0 +1,26 @@ +// copied from http://stackoverflow.com/questions/233507/how-to-log-out-user-from-web-site-using-basic-authentication +char *cdwLogoutJs = +"function logout(secUrl, redirUrl) {\n" +" if (bowser.msie) {\n" +" document.execCommand('ClearAuthenticationCache', 'false');\n" +" } else if (bowser.gecko) {\n" +" $.ajax({\n" +" async: false,\n" +" url: secUrl,\n" +" type: 'GET',\n" +" username: 'logout'\n" +" });\n" +" } else if (bowser.webkit || bowser.chrome) {\n" +" var xmlhttp = new XMLHttpRequest();\n" +" xmlhttp.open(\"GET\", secUrl, true);\n" +" xmlhttp.setRequestHeader(\"Authorization\", \"Basic logout\");\n" +" xmlhttp.send();\n" +" } else {\n" +// http://stackoverflow.com/questions/5957822/how-to-clear-basic-authentication-details-in-chrome +" redirUrl = url.replace('http://', 'http://' + new Date().getTime() + '@');\n" +" }\n" +" setTimeout(function () {\n" +" window.location.href = redirUrl;\n" +" }, 200);\n" +"}\n" +;