From 6ee6633e6d377d7a7539dea0fca3f974626a9f94 Mon Sep 17 00:00:00 2001 From: Rohit Yadav Date: Thu, 17 Sep 2020 10:15:11 +0530 Subject: [PATCH] ui: call logout before login to clear old sessionkey cookies (#4326) This handle edge cases of upgrades and when legacy UI is used along with Primate or any UI sharing cookies. The specific case it fixes involves removal of duplicate sessionkey cookies. Signed-off-by: Rohit Yadav --- ui/scripts/cloudStack.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js index e6550b73074..9e01271fc13 100644 --- a/ui/scripts/cloudStack.js +++ b/ui/scripts/cloudStack.js @@ -280,6 +280,15 @@ var loginCmdText = array1.join(""); + // Logout before login is called to purge any duplicate sessionkey cookies + // to handle edge cases around upgrades and using legacy UI with Primate + $.ajax({ + url: createURL('logout'), + async: false, + success: function() {}, + error: function() {} + }); + $.ajax({ type: "POST", data: "command=login" + loginCmdText + "&response=json",