CS-14047: Return the user to the log in page when login time out.

This commit is contained in:
olgasmola 2012-06-18 16:04:37 +03:00 committed by Jessica Wang
parent d03fb2a7e2
commit a30fe62b11
1 changed files with 20 additions and 3 deletions

View File

@ -66,14 +66,31 @@
dataType: 'json',
cache: false,
error: function(data) {
cloudStack.dialog.notice({ message: parseXMLHttpResponse(data) });
var clickAction = false;
if (isValidJsonString(data.responseText)) {
var json = JSON.parse(data.responseText);
if (json != null) {
var property;
for(property in json) {}
var errorObj = json[property];
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) {
beforeSend: function(XMLHttpRequest) {
if (g_mySession == $.cookie("JSESSIONID")) {
return true;
}
else {
cloudStack.dialog.notice({ message: _l('label.session.expired') });
var clickAction = function() {
$('#user-options a').eq(0).trigger('click');
};
cloudStack.dialog.notice({ message: _l('label.session.expired'), clickAction: clickAction });
return false;
}
}