Updated Branches:
  refs/heads/master d03fb2a7e -> a30fe62b1

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/master
Commit: a30fe62b116e6f192bc2a52cfa51b3280693699f
Parents: d03fb2a
Author: olgasmola <[email protected]>
Authored: Mon Jun 18 16:04:37 2012 +0300
Committer: Jessica Wang <[email protected]>
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;
                                }
                        }       

Reply via email to