You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by al...@apache.org on 2012/06/29 02:45:07 UTC

[30/50] [abbrv] git commit: CS-14047: Return the user to the log in page when login time out.

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


Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/a30fe62b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/a30fe62b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/a30fe62b

Branch: refs/heads/vpc
Commit: a30fe62b116e6f192bc2a52cfa51b3280693699f
Parents: d03fb2a
Author: olgasmola <ol...@gmail.com>
Authored: Mon Jun 18 16:04:37 2012 +0300
Committer: Jessica Wang <je...@citrix.com>
Committed: Wed Jun 27 13:43:05 2012 -0700

----------------------------------------------------------------------
 ui/scripts/cloudStack.js |   23 ++++++++++++++++++++---
 1 files changed, 20 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/a30fe62b/ui/scripts/cloudStack.js
----------------------------------------------------------------------
diff --git a/ui/scripts/cloudStack.js b/ui/scripts/cloudStack.js
index 1decd68..3293c25 100644
--- a/ui/scripts/cloudStack.js
+++ b/ui/scripts/cloudStack.js
@@ -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;
 				}
 			}