Skip to content

Commit a30fe62

Browse files
olgasmolaJessica Wang
authored andcommitted
CS-14047: Return the user to the log in page when login time out.
1 parent d03fb2a commit a30fe62

1 file changed

Lines changed: 20 additions & 3 deletions

File tree

‎ui/scripts/cloudStack.js‎

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,31 @@
6666
dataType: 'json',
6767
cache: false,
6868
error: function(data) {
69-
cloudStack.dialog.notice({ message: parseXMLHttpResponse(data) });
69+
var clickAction = false;
70+
if (isValidJsonString(data.responseText)) {
71+
var json = JSON.parse(data.responseText);
72+
if (json != null) {
73+
var property;
74+
for(property in json) {}
75+
var errorObj = json[property];
76+
if(errorObj.errorcode == 401 && errorObj.errortext == "unable to verify user credentials and/or request signature") {
77+
clickAction = function() {
78+
$('#user-options a').eq(0).trigger('click');
79+
};
80+
}
81+
}
82+
}
83+
cloudStack.dialog.notice({ message: parseXMLHttpResponse(data), clickAction: clickAction });
7084
},
71-
beforeSend: function(XMLHttpRequest) {
85+
beforeSend: function(XMLHttpRequest) {
7286
if (g_mySession == $.cookie("JSESSIONID")) {
7387
return true;
7488
}
7589
else {
76-
cloudStack.dialog.notice({ message: _l('label.session.expired') });
90+
var clickAction = function() {
91+
$('#user-options a').eq(0).trigger('click');
92+
};
93+
cloudStack.dialog.notice({ message: _l('label.session.expired'), clickAction: clickAction });
7794
return false;
7895
}
7996
}

0 commit comments

Comments
 (0)