diff options
author | 2016-11-01 14:48:16 +0800 | |
---|---|---|
committer | 2016-11-01 14:48:16 +0800 | |
commit | 2d990d100948f46833bd31154d0a206d43aefa9c (patch) | |
tree | 12c320dc020cbc3b20d6afbb8fb04325a69095f3 /openo-portal/portal-common | |
parent | 83981e7803e0be6909babadea960599efec8dfb5 (diff) |
Change the login js logic in the login.js. make it can work now
https://jira.open-o.org/browse/OCS-130
Change-Id: I0ae3fad366afeb67d1bed71a63f48f19eab8b13b
Signed-off-by: zhouruiyu <zhouruiyu@huawei.com>
Diffstat (limited to 'openo-portal/portal-common')
-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"; }); }; |