diff options
Diffstat (limited to 'openo-portal')
-rw-r--r-- | openo-portal/portal-common/src/main/webapp/common/js/login.js | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/openo-portal/portal-common/src/main/webapp/common/js/login.js b/openo-portal/portal-common/src/main/webapp/common/js/login.js index d129b927..61d96b53 100644 --- a/openo-portal/portal-common/src/main/webapp/common/js/login.js +++ b/openo-portal/portal-common/src/main/webapp/common/js/login.js @@ -29,13 +29,22 @@ function loginSubmitHandler() { url : "/openoapi/auth/v1/tokens", type : "POST", contentType : 'application/json; charset=utf-8', - data : JSON.stringify(loginData), - success : function(data) { - top.window.document.location.href = "default.html"; - }, - error : function(data) { - top.window.document.location.href = "login.html"; + data : JSON.stringify(loginData) + }).done(function(data) { + var topURL = top.window.document.location.href; + if (topURL.indexOf("?service") != -1) { + top.window.document.location.href = decodeURIComponent(topURL.substring(topURL.indexOf("?service")+9)); + } else { + top.window.document.location.href = "/openoui/common/default.html"; + } + }).fail(function(data) { + if (data.status == 401) { + alert("the username or password is wrong.") + // username or pasword is wrong. + } else { + // system error. } + top.window.document.location.href = "/openoui/common/login.html"; }); }; |