Blame SOURCES/0005-Fix-registry-console-Windows-IE-and-Edge-login.patch

33cfa9
From 96d64114ecedbb1203199339d443aba8f79f2417 Mon Sep 17 00:00:00 2001
33cfa9
From: petervo <petervo@redhat.com>
33cfa9
Date: Thu, 10 Nov 2016 12:21:28 -0800
33cfa9
Subject: [5/7] Fix registry console Windows IE and Edge login
33cfa9
33cfa9
https://bugzilla.redhat.com/show_bug.cgi?id=1378810
33cfa9
https://bugzilla.redhat.com/show_bug.cgi?id=1393740
33cfa9
33cfa9
Upstream commits:
33cfa9
b403d66ff9b2a74c58dc296236491af2aae33601
33cfa9
    ws: Explictly set no-cache on all login responses
33cfa9
80a239cf53d0eb44fef5da3e3b31d67bb065e336
33cfa9
    ws: Extract baseURI from tag for some IEs
33cfa9
33cfa9
Closes #5363
33cfa9
Signed-off-by: Stef Walter <stefw@redhat.com>
33cfa9
 * Signing off inclusion in the rhel-7.3.1 branch
33cfa9
---
33cfa9
 src/ws/cockpithandlers.c |  2 ++
33cfa9
 src/ws/login.html        | 13 ++++++++++++-
33cfa9
 2 files changed, 14 insertions(+), 1 deletion(-)
33cfa9
33cfa9
diff --git a/src/ws/cockpithandlers.c b/src/ws/cockpithandlers.c
33cfa9
index f96354e..1611fdd 100644
33cfa9
--- a/src/ws/cockpithandlers.c
33cfa9
+++ b/src/ws/cockpithandlers.c
33cfa9
@@ -408,6 +408,8 @@ on_login_complete (GObject *object,
33cfa9
   headers = cockpit_web_server_new_table ();
33cfa9
   response_data = cockpit_auth_login_finish (COCKPIT_AUTH (object), result, flags, headers, &error);
33cfa9
 
33cfa9
+  /* Never cache a login response */
33cfa9
+  cockpit_web_response_set_cache_type (response, COCKPIT_WEB_RESPONSE_NO_CACHE);
33cfa9
   if (error)
33cfa9
     {
33cfa9
       if (response_data)
33cfa9
diff --git a/src/ws/login.html b/src/ws/login.html
33cfa9
index 3eb30f5..d114cc0 100644
33cfa9
--- a/src/ws/login.html
33cfa9
+++ b/src/ws/login.html
33cfa9
@@ -133,8 +133,19 @@
33cfa9
             /* Sets values for application, url_root and login_path */
33cfa9
             function setup_path_globals (path) {
33cfa9
                 var parser = document.createElement('a');
33cfa9
+                var base = document.baseURI;
33cfa9
+                var base_tags;
33cfa9
+                /* Some IEs don't support baseURI */
33cfa9
+                if (!base) {
33cfa9
+                    base_tags = document.getElementsByTagName ("base");
33cfa9
+                    if (base_tags.length > 0)
33cfa9
+                        base = base_tags[0].href;
33cfa9
+                    else
33cfa9
+                        base = "/";
33cfa9
+                }
33cfa9
+
33cfa9
                 path = path || "/";
33cfa9
-                parser.href = document.baseURI;
33cfa9
+                parser.href = base;
33cfa9
                 if (parser.pathname != "/") {
33cfa9
                     url_root = parser.pathname.replace(/^\/+|\/+$/g, '');
33cfa9
                     window.localStorage.setItem('url-root', url_root);
33cfa9
-- 
33cfa9
2.5.5
33cfa9