Merge branch 'feature/dingdingLogin' into pre
This commit is contained in:
commit
d8ca47f717
@ -273,7 +273,8 @@ public class DangerOperationController {
|
|||||||
|
|
||||||
// 如果没有配置 AppSecret,则无法进行后续交互
|
// 如果没有配置 AppSecret,则无法进行后续交互
|
||||||
if (!StringUtils.hasText(appSecret)) {
|
if (!StringUtils.hasText(appSecret)) {
|
||||||
log.error("【dingtalk】DingTalk AppSecret not configured");
|
log.info("【dingtalk】DingTalk AppSecret not configured");
|
||||||
|
model.addAttribute("isAuthenticated", false);
|
||||||
model.addAttribute("authError", "服务端未配置 AppSecret,无法登录");
|
model.addAttribute("authError", "服务端未配置 AppSecret,无法登录");
|
||||||
return "form";
|
return "form";
|
||||||
}
|
}
|
||||||
@ -297,7 +298,8 @@ public class DangerOperationController {
|
|||||||
String accessToken = tokenJson.getString("accessToken");
|
String accessToken = tokenJson.getString("accessToken");
|
||||||
|
|
||||||
if (!StringUtils.hasText(accessToken)) {
|
if (!StringUtils.hasText(accessToken)) {
|
||||||
log.error("【dingtalk】Failed to get access token: {}", tokenResponse);
|
log.info("【dingtalk】Failed to get access token: {}", tokenResponse);
|
||||||
|
model.addAttribute("isAuthenticated", false);
|
||||||
model.addAttribute("authError", "钉钉登录验证失败: 无法获取 AccessToken");
|
model.addAttribute("authError", "钉钉登录验证失败: 无法获取 AccessToken");
|
||||||
return "form";
|
return "form";
|
||||||
}
|
}
|
||||||
@ -315,13 +317,16 @@ public class DangerOperationController {
|
|||||||
String mobile = userJson.getString("mobile");
|
String mobile = userJson.getString("mobile");
|
||||||
|
|
||||||
if (!StringUtils.hasText(mobile)) {
|
if (!StringUtils.hasText(mobile)) {
|
||||||
log.error("【dingtalk】Failed to get user info: {}", userInfoResponse);
|
log.info("【dingtalk】Failed to get user info: {}", userInfoResponse);
|
||||||
|
model.addAttribute("isAuthenticated", false);
|
||||||
model.addAttribute("authError", "钉钉登录验证失败: 无法获取用户手机号");
|
model.addAttribute("authError", "钉钉登录验证失败: 无法获取用户手机号");
|
||||||
return "form";
|
return "form";
|
||||||
}
|
}
|
||||||
|
|
||||||
List<ThirdPartyUserDTO> users = RpcExternalUtil.rpcApiResultProcessor(() -> thirdPartySyncApi.getUserInfosByPhone(mobile), "查询用户是否存在", mobile);
|
List<ThirdPartyUserDTO> users = RpcExternalUtil.rpcApiResultProcessor(() -> thirdPartySyncApi.getUserInfosByPhone(mobile), "查询用户是否存在", mobile);
|
||||||
if (CollectionUtils.isEmpty(users)) {
|
if (CollectionUtils.isEmpty(users)) {
|
||||||
|
log.info("【dingtalk】Failed to get user info2: {}", JSON.toJSONString(users));
|
||||||
|
model.addAttribute("isAuthenticated", false);
|
||||||
model.addAttribute("authError", "用户未授权!");
|
model.addAttribute("authError", "用户未授权!");
|
||||||
return "form";
|
return "form";
|
||||||
}
|
}
|
||||||
@ -341,7 +346,8 @@ public class DangerOperationController {
|
|||||||
return "form";
|
return "form";
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("【dingtalk】DingTalk Callback Error", e);
|
log.info("【dingtalk】DingTalk Callback Error", e);
|
||||||
|
model.addAttribute("isAuthenticated", false);
|
||||||
model.addAttribute("authError", "登录过程中发生异常: " + e.getMessage());
|
model.addAttribute("authError", "登录过程中发生异常: " + e.getMessage());
|
||||||
return "form";
|
return "form";
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,35 +34,53 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style type="text/tailwindcss">
|
<style type="text/css">
|
||||||
@layer utilities {
|
/* 自定义表单输入焦点样式 */
|
||||||
.form-input-focus {
|
.form-input-focus:focus {
|
||||||
@apply focus:border-primary focus:ring-2 focus:ring-primary/20 focus:outline-none;
|
border-color: #165DFF;
|
||||||
}
|
box-shadow: 0 0 0 2px rgba(22, 93, 255, 0.2);
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
|
||||||
.form-transition {
|
/* 过渡动画 */
|
||||||
@apply transition-all duration-300 ease-in-out;
|
.form-transition {
|
||||||
}
|
transition: all 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
.card-shadow {
|
/* 卡片阴影效果 */
|
||||||
@apply shadow-lg hover:shadow-xl transition-shadow duration-300;
|
.card-shadow {
|
||||||
}
|
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
|
||||||
|
transition: box-shadow 0.3s;
|
||||||
|
}
|
||||||
|
|
||||||
.form-hidden {
|
.card-shadow:hover {
|
||||||
@apply hidden opacity-0 h-0;
|
box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-visible {
|
/* 表单隐藏状态 */
|
||||||
@apply opacity-100 h-auto;
|
.form-hidden {
|
||||||
}
|
display: none;
|
||||||
|
opacity: 0;
|
||||||
|
height: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
.mask-fade {
|
/* 表单显示状态 */
|
||||||
@apply transition-opacity duration-300 ease-in-out;
|
.form-visible {
|
||||||
}
|
display: block;
|
||||||
|
opacity: 1;
|
||||||
|
height: auto;
|
||||||
|
}
|
||||||
|
|
||||||
.tab-active {
|
/* 遮罩层渐变效果 */
|
||||||
@apply text-primary border-primary;
|
.mask-fade {
|
||||||
}
|
transition: opacity 0.3s ease-in-out;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* 标签页激活状态 */
|
||||||
|
.tab-active {
|
||||||
|
color: #165DFF;
|
||||||
|
border-color: #165DFF;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
@ -148,7 +166,7 @@
|
|||||||
<!-- 授权验证区域 - 未认证时显示 -->
|
<!-- 授权验证区域 - 未认证时显示 -->
|
||||||
<div th:unless="${isAuthenticated}">
|
<div th:unless="${isAuthenticated}">
|
||||||
<!-- 错误提示 Banner -->
|
<!-- 错误提示 Banner -->
|
||||||
<div class="mb-4 bg-red-50 border border-red-200 rounded-lg p-4 flex items-center"
|
<div id="authError" class="mb-4 bg-red-50 border border-red-200 rounded-lg p-4 flex items-center"
|
||||||
th:if="${authError != null}">
|
th:if="${authError != null}">
|
||||||
<i class="fa fa-exclamation-circle text-danger text-lg mr-3"></i>
|
<i class="fa fa-exclamation-circle text-danger text-lg mr-3"></i>
|
||||||
<div>
|
<div>
|
||||||
@ -587,20 +605,20 @@
|
|||||||
// 页面加载时检查后端消息
|
// 页面加载时检查后端消息
|
||||||
document.addEventListener('DOMContentLoaded', function () {
|
document.addEventListener('DOMContentLoaded', function () {
|
||||||
// 检查流程操作的后端消息(使用 Thymeleaf JS 内联语法)
|
// 检查流程操作的后端消息(使用 Thymeleaf JS 内联语法)
|
||||||
/*[[#{
|
const serverMessage = /*[[${message}]]*/ null;
|
||||||
if (${message != null}) {
|
if (serverMessage && serverMessage !== 'null') {
|
||||||
operationMessage.classList.remove('hidden');
|
operationMessage.classList.remove('hidden');
|
||||||
if (${message.startsWith('操作成功')}) {
|
if (serverMessage.includes('成功')) {
|
||||||
operationMessage.className = 'mt-4 p-4 rounded-lg bg-green-50 border border-green-200 text-green-700';
|
operationMessage.className = 'mt-4 p-4 rounded-lg bg-green-50 border border-green-200 text-green-700';
|
||||||
} else {
|
} else {
|
||||||
operationMessage.className = 'mt-4 p-4 rounded-lg bg-red-50 border border-red-200 text-red-700';
|
operationMessage.className = 'mt-4 p-4 rounded-lg bg-red-50 border border-red-200 text-red-700';
|
||||||
}
|
}
|
||||||
operationMessage.innerHTML = '<i class="fa ' + (${message.startsWith('操作成功')} ? 'fa-check-circle' : 'fa-exclamation-circle') + ' mr-2"></i>' + '${message}';
|
const iconClass = serverMessage.includes('成功') ? 'fa-check-circle' : 'fa-exclamation-circle';
|
||||||
|
operationMessage.innerHTML = `<i class="fa ${iconClass} mr-2"></i>${serverMessage}`;
|
||||||
}
|
}
|
||||||
}]]*/
|
|
||||||
|
|
||||||
// 显示授权错误(如果有)
|
// 显示授权错误(如果有)
|
||||||
if (authError && authError.textContent.trim() !== '') {
|
if (authError && authError.textContent.trim() !== '' && !authError.textContent.includes('${authError}')) {
|
||||||
authError.classList.remove('hidden');
|
authError.classList.remove('hidden');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user