Skip to content

Commit a308f37

Browse files
Jessica Wangyadvr
authored andcommitted
CS-18149: UI - no longer store sessionKey in cookie. After
... this change, opening the 2nd browser window (of the same domain) will show login screen (i.e. user has to enter credentials again) and will cause the 1st browser window session timeout. Signed-off-by: Rohit Yadav <[email protected]> (cherry picked from commit 19e3c01) Signed-off-by: Rohit Yadav <[email protected]>
1 parent b9d624d commit a308f37

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

ui/scripts/cloudStack.js

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@
105105
bypassLoginCheck: function(args) { //determine to show or bypass login screen
106106
if (g_loginResponse == null) { //show login screen
107107
/*
108-
but if this is a 2nd browser window (of the same domain), login screen still won't show because $.cookie('sessionKey') is valid for 2nd browser window (of the same domain) as well.
109-
i.e. calling listCapabilities API with g_sessionKey from $.cookie('sessionKey') will succeed,
110-
then userValid will be set to true, then an user object (instead of "false") will be returned, then login screen will be bypassed.
111-
*/
108+
* Since we no longer store sessionKey in cookie, opening the
109+
* 2nd browser window (of the same domain) will show login screen (i.e. user has to
110+
* enter credentials again) and will cause the 1st browser window session timeout.
111+
*/
112112
var unBoxCookieValue = function (cookieName) {
113113
var cookieValue = $.cookie(cookieName);
114114
if (cookieValue && cookieValue.length > 2 && cookieValue[0] === '"' && cookieValue[cookieValue.length-1] === '"') {
@@ -117,7 +117,7 @@
117117
}
118118
return cookieValue;
119119
};
120-
g_sessionKey = unBoxCookieValue('sessionKey');
120+
g_sessionKey = unBoxCookieValue('JSESSIONID');
121121
g_role = unBoxCookieValue('role');
122122
g_userid = unBoxCookieValue('userid');
123123
g_domainid = unBoxCookieValue('domainid');
@@ -226,9 +226,6 @@
226226
g_timezone = loginresponse.timezone;
227227
g_userfullname = loginresponse.firstname + ' ' + loginresponse.lastname;
228228

229-
$.cookie('sessionKey', g_sessionKey, {
230-
expires: 1
231-
});
232229
$.cookie('username', g_username, {
233230
expires: 1
234231
});
@@ -324,7 +321,7 @@
324321
g_regionsecondaryenabled = null;
325322
g_loginCmdText = null;
326323

327-
$.cookie('sessionKey', null);
324+
$.cookie('JSESSIONID', null);
328325
$.cookie('username', null);
329326
$.cookie('account', null);
330327
$.cookie('domainid', null);
@@ -347,7 +344,7 @@
347344
},
348345

349346
samlLoginAction: function(args) {
350-
$.cookie('sessionKey', null);
347+
$.cookie('JSESSIONID', null);
351348
$.cookie('username', null);
352349
$.cookie('account', null);
353350
$.cookie('domainid', null);

0 commit comments

Comments
 (0)