Browse Source

sctj

master
Hailei 1 year ago
parent
commit
1e214e99c3
2 changed files with 52 additions and 8 deletions
  1. +2
    -1
      src/main/java/com/ciotea/cdcng/front/infrastructure/spring/security/web/authentication/MyLogoutSuccessHandler.java
  2. +50
    -7
      src/main/webapp/system1/login/ssoLoginCenter.js

+ 2
- 1
src/main/java/com/ciotea/cdcng/front/infrastructure/spring/security/web/authentication/MyLogoutSuccessHandler.java View File

@ -24,7 +24,8 @@ public class MyLogoutSuccessHandler implements LogoutSuccessHandler {
}
}
if (flag) {
httpServletResponse.sendRedirect("http://221.237.111.10:50080/workbench-pc/");
// httpServletResponse.sendRedirect("http://221.237.111.10:50080/workbench-pc/");
httpServletRequest.getRequestDispatcher("http://221.237.111.10:50080/workbench-pc/").forward(httpServletRequest, httpServletResponse);
}
}
}

+ 50
- 7
src/main/webapp/system1/login/ssoLoginCenter.js View File

@ -4,11 +4,54 @@ $(document).ready(function() {
if (toPage) {
destination = toPage;
}
var doPointLogin = function(data) {
// 先拿用户信息
}
if (url.indexOf("code")){doPointLogin(data)}
var url = window.location.href;
//回调地址的所有参数
var str = url.split('?')[1];
//参数的值
var code = str.split('=')[1];
$.cookie('loginType', 'sso', {path: contextPath + '/'});
var data = {
code: code
};
$.ajax({
type: 'POST', // 请求类型
url: '/system/point/getUser', // 后端接口地址
data: data, // 要发送的数据
dataType: 'json', // 期望的数据类型
success: function(response) {
var pointUserInfo = response.data;
console.log(pointUserInfo);
console.log("===response.data.data===");
console.log(pointUserInfo.data);
var data1 = {
url : '/doLogin',
username : pointUserInfo.cngName,
password : pointUserInfo.password,
checkCode : null
};
//验证登录
$.ajax({
type: 'POST', // 请求类型
url: data1.url,
data: data1, // 要发送的数据
dataType: 'text', // 期望的数据类型
}).done(
function(msg) {
if (msg === 'authentication success') {
window.location.href = destination;
} else {
//门户网站地址
// window.location.href = url;
window.open(url)
}
}
);
},
error: function(xhr, status, error) {
// 请求失败时的处理
console.error('Error:', error);
// 这里处理错误情况
window.location.href = url;
}
});
});

Loading…
Cancel
Save