logout.html 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!DOCTYPE html>
  2. <html lang="zh-CN">
  3. <head>
  4. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  5. <meta charset="UTF-8">
  6. <title></title>
  7. <script src="../o2_core/o2.js"></script>
  8. <!-- <script src="js/sso.min.js"></script>-->
  9. <script>
  10. o2.addReady(function(){
  11. var uri = new URI(window.location.toString());
  12. var redirect = uri.getData("redirect");
  13. sendRequest("/x_organization_assemble_authentication/jaxrs/authentication", "GET", function(json){
  14. if (json.data.tokenType==='anonymous'){
  15. toRedirect()
  16. }else{
  17. debugger;
  18. sendRequest("/x_organization_assemble_authentication/jaxrs/authentication", "DELETE", toRedirect, toRedirect);
  19. }
  20. }, toRedirect)
  21. function toRedirect(){
  22. if (redirect){
  23. window.location = redirect;
  24. }else{
  25. window.location = "/";
  26. }
  27. }
  28. function sendRequest(url, method, success, error){
  29. var res = new Request.JSON({
  30. url: o2.filterUrl(url),
  31. secure: false,
  32. noCache: true,
  33. method: method,
  34. emulation: false,
  35. withCredentials: true,
  36. onSuccess: function(responseJSON){
  37. success(responseJSON);
  38. }.bind(this),
  39. onFailure: function(){
  40. error()
  41. }.bind(this),
  42. onError: function(){
  43. error()
  44. }.bind(this)
  45. });
  46. res.setHeader("Content-Type", "application/json; charset=utf-8");
  47. res.send();
  48. }
  49. });
  50. </script>
  51. </head>
  52. <body>
  53. </body>
  54. </html>