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 <rohit.yadav@shapeblue.com>
This commit is contained in:
Jessica Wang 2015-03-13 13:14:42 +05:30 committed by Rohit Yadav
parent 0b5b9c91e4
commit 19e3c0168e

View File

@ -105,9 +105,9 @@
bypassLoginCheck: function(args) { //determine to show or bypass login screen bypassLoginCheck: function(args) { //determine to show or bypass login screen
if (g_loginResponse == null) { //show login screen if (g_loginResponse == null) { //show login screen
/* /*
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. * Since we no longer store sessionKey in cookie, opening the
i.e. calling listCapabilities API with g_sessionKey from $.cookie('sessionKey') will succeed, * 2nd browser window (of the same domain) will show login screen (i.e. user has to
then userValid will be set to true, then an user object (instead of "false") will be returned, then login screen will be bypassed. * enter credentials again) and will cause the 1st browser window session timeout.
*/ */
var unBoxCookieValue = function (cookieName) { var unBoxCookieValue = function (cookieName) {
var cookieValue = $.cookie(cookieName); var cookieValue = $.cookie(cookieName);
@ -117,7 +117,7 @@
} }
return cookieValue; return cookieValue;
}; };
g_sessionKey = unBoxCookieValue('sessionKey'); g_sessionKey = unBoxCookieValue('JSESSIONID');
g_role = unBoxCookieValue('role'); g_role = unBoxCookieValue('role');
g_userid = unBoxCookieValue('userid'); g_userid = unBoxCookieValue('userid');
g_domainid = unBoxCookieValue('domainid'); g_domainid = unBoxCookieValue('domainid');
@ -226,9 +226,6 @@
g_timezone = loginresponse.timezone; g_timezone = loginresponse.timezone;
g_userfullname = loginresponse.firstname + ' ' + loginresponse.lastname; g_userfullname = loginresponse.firstname + ' ' + loginresponse.lastname;
$.cookie('sessionKey', g_sessionKey, {
expires: 1
});
$.cookie('username', g_username, { $.cookie('username', g_username, {
expires: 1 expires: 1
}); });
@ -324,7 +321,7 @@
g_regionsecondaryenabled = null; g_regionsecondaryenabled = null;
g_loginCmdText = null; g_loginCmdText = null;
$.cookie('sessionKey', null); $.cookie('JSESSIONID', null);
$.cookie('username', null); $.cookie('username', null);
$.cookie('account', null); $.cookie('account', null);
$.cookie('domainid', null); $.cookie('domainid', null);
@ -347,7 +344,7 @@
}, },
samlLoginAction: function(args) { samlLoginAction: function(args) {
$.cookie('sessionKey', null); $.cookie('JSESSIONID', null);
$.cookie('username', null); $.cookie('username', null);
$.cookie('account', null); $.cookie('account', null);
$.cookie('domainid', null); $.cookie('domainid', null);