if(errorObj.errorcode==401&&errorObj.errortext=="unable to verify user credentials and/or request signature"){
clickAction=function(){
$('#user-options a').eq(0).trigger('click');
};
}
}
}
cloudStack.dialog.notice({
message: parseXMLHttpResponse(data),
clickAction: clickAction
});
},
beforeSend: function(XMLHttpRequest){
if(g_mySession==$.cookie("JSESSIONID")){
returntrue;
}else{
varclickAction=function(){
$('#user-options a').eq(0).trigger('click');
};
cloudStack.dialog.notice({
message: _l('label.session.expired'),
clickAction: clickAction
});
returnfalse;
}
}
});
var$container=$('#cloudStack3-container');
varloginArgs={
$container: $container,
// Use this for checking the session, to bypass login screen
bypassLoginCheck: function(args){//determine to show or bypass 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.
i.e. calling listCapabilities API with g_sessionKey from $.cookie('sessionKey') will succeed,
then userValid will be set to true, then an user object (instead of "false") will be returned, then login screen will be bypassed.
varintervalLimit=((json.listcapabilitiesresponse.capability.apilimitinterval*1000)/json.listcapabilitiesresponse.capability.apilimitmax)*3;//multiply 3 to be on safe side
//intervalLimit = 9999; //this line is for testing only, comment it before check in
if(intervalLimit>g_queryAsyncJobResultInterval)
g_queryAsyncJobResultInterval=intervalLimit;
}
userValid=true;
},
error: function(xmlHTTP){//override default error handling, do nothing instead of showing error "unable to verify user credentials" on login screen
varintervalLimit=((json.listcapabilitiesresponse.capability.apilimitinterval*1000)/json.listcapabilitiesresponse.capability.apilimitmax)*3;//multiply 3 to be on safe side
//intervalLimit = 8888; //this line is for testing only, comment it before check in