From 2d990d100948f46833bd31154d0a206d43aefa9c Mon Sep 17 00:00:00 2001 From: zhouruiyu Date: Tue, 1 Nov 2016 14:48:16 +0800 Subject: 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 --- .../src/main/webapp/common/js/login.js | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'openo-portal/portal-common') 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"; }); }; -- cgit 1.2.3-korg