ui: if session cookie exists, use it to set global session holder and invalidate it

The 19e3c0168e commit breaks SAML login and any
login where redirection is used.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java
This commit is contained in:
Rohit Yadav 2015-03-13 15:01:11 +05:30 committed by Daan Hoogland
parent d3122a1b8c
commit e8f7215b26
1 changed files with 12 additions and 2 deletions

View File

@ -137,14 +137,22 @@
}
return cookieValue;
};
g_sessionKey = unBoxCookieValue('JSESSIONID');
unBoxCookieValue('sessionkey');
// if sessionkey cookie exists use this to set g_sessionKey
// and destroy sessionkey cookie
if ($.cookie('sessionkey')) {
g_sessionKey = $.cookie('sessionkey');
$.cookie('sessionkey', null);
} else {
g_sessionKey = unBoxCookieValue('JSESSIONID');
}
g_role = unBoxCookieValue('role');
g_userid = unBoxCookieValue('userid');
g_domainid = unBoxCookieValue('domainid');
g_account = unBoxCookieValue('account');
g_username = unBoxCookieValue('username');
g_userfullname = unBoxCookieValue('userfullname');
g_timezone = unBoxCookieValue('timezone');
g_timezone = unBoxCookieValue('timezone');
} else { //single-sign-on (bypass login screen)
g_mySession = $.cookie('JSESSIONID');
g_sessionKey = encodeURIComponent(g_loginResponse.sessionkey);
@ -397,6 +405,7 @@
g_loginCmdText = null;
$.cookie('JSESSIONID', null);
$.cookie('sessionkey', null);
$.cookie('username', null);
$.cookie('account', null);
$.cookie('domainid', null);
@ -423,6 +432,7 @@
samlLoginAction: function(args) {
$.cookie('JSESSIONID', null);
$.cookie('sessionkey', null);
$.cookie('username', null);
$.cookie('account', null);
$.cookie('domainid', null);