From 94d228eaa7dcf05945bbff17d8e283f0aff46235 Mon Sep 17 00:00:00 2001 From: Jessica Wang Date: Mon, 14 May 2012 13:51:29 -0700 Subject: [PATCH] cloudstack 3.0 UI - When API returns an error whose errorcode is 401, show Session Timeout message instead of errortext in API response ("unable to verify user credentials and/or request signature"). So it will be clear to user what to do next (i.e. log out and log in again). --- ui/scripts/sharedFunctions.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ui/scripts/sharedFunctions.js b/ui/scripts/sharedFunctions.js index 3202e1aa583..91589f0b972 100644 --- a/ui/scripts/sharedFunctions.js +++ b/ui/scripts/sharedFunctions.js @@ -180,9 +180,13 @@ function parseXMLHttpResponse(XMLHttpResponse) { if (json != null) { var property; for(property in json) {} - var errorObj = json[property]; - return _s(errorObj.errortext); - } else { + var errorObj = json[property]; + if(errorObj.errorcode == 401 && errorObj.errortext == "unable to verify user credentials and/or request signature") + return _l('label.session.expired'); + else + return _s(errorObj.errortext); + } + else { return ""; } }