fix - 调整登陆成功后的页面地址

This commit is contained in:
wangli 2026-01-14 16:37:24 +08:00
parent f577b818bc
commit e9e2c026ad

View File

@ -298,21 +298,7 @@ public class DangerOperationController {
session.setAttribute("isAuthenticated", true);
// 可以把用户信息也存进去
session.setAttribute("dingUser", userJson);
// 重定向回表单页使用完整的URL包括域名和contextPath
String scheme = request.getScheme(); // http https
String serverName = request.getServerName(); // 服务器名称
int serverPort = request.getServerPort(); // 端口号
String contextPath = request.getContextPath(); // 上下文路径
StringBuilder redirectUrl = new StringBuilder();
redirectUrl.append(scheme).append("://").append(serverName);
if (("http".equals(scheme) && serverPort != 80) || ("https".equals(scheme) && serverPort != 443)) {
redirectUrl.append(":").append(serverPort);
}
redirectUrl.append(contextPath).append("/web/process/form");
return "redirect:" + redirectUrl.toString();
return "form";
} catch (Exception e) {
log.error("DingTalk Callback Error", e);