From 75f117d8bed095c9065df5e78ac052a376606072 Mon Sep 17 00:00:00 2001 From: "Crystal.Sea" Date: Sat, 16 Oct 2021 11:16:01 +0800 Subject: [PATCH] language --- ReleaseNotes.txt | 12 ++++++---- .../AbstractSocialSignOnEndpoint.java | 16 +++++++------ .../socialsignon/SocialSignOnEndpoint.java | 17 +++++++++---- .../resources/messages/message.properties | 1 + .../resources/messages/message_en.properties | 1 + .../messages/message_zh_CN.properties | 1 + .../templates/views/layout/nologintop.ftl | 24 +++++++------------ .../templates/views/loginworkweixin.ftl | 4 ++-- 8 files changed, 43 insertions(+), 33 deletions(-) diff --git a/ReleaseNotes.txt b/ReleaseNotes.txt index 5042e660..51c4be84 100644 --- a/ReleaseNotes.txt +++ b/ReleaseNotes.txt @@ -14,11 +14,13 @@ *(MAXKEY-210813) 管理端图标显示修复 *(MAXKEY-210814) 管理端‘应用管理’移动到‘配置管理’的菜单项 *(MAXKEY-210815) OAuth的数据库加载增加本地缓存 - *(MAXKEY-210816) 社交账号登录改为存储在数据库中,方便用户更改 - *(MAXKEY-210817) 账号策略管理及动态适配 - *(MAXKEY-210818) 社交账号登录过程优化 - *(MAXKEY-210819) 调整了机构显示树的样式 - *(MAXKEY-210820) 依赖jar引用、更新和升级 + *(MAXKEY-210816) 社交账号登录改为存储在数据库中,方便用户更改 + *(MAXKEY-210817) 账号策略管理及动态适配 + *(MAXKEY-210818) 社交账号登录过程优化 + *(MAXKEY-210819) 调整了机构显示树的样式 + *(MAXKEY-210820) 企业微信扫码登录js更新wwLogin-1.2.4.js + *(MAXKEY-210821) 中文切换调整为下拉菜单 + *(MAXKEY-210822) 依赖jar引用、更新和升级 mybatis-jpa-extra 2.6 druid 1.2.8 caffeine 2.9.2 diff --git a/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/AbstractSocialSignOnEndpoint.java b/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/AbstractSocialSignOnEndpoint.java index 2d605559..92acb5f8 100644 --- a/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/AbstractSocialSignOnEndpoint.java +++ b/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/AbstractSocialSignOnEndpoint.java @@ -113,8 +113,8 @@ public class AbstractSocialSignOnEndpoint { authCallback.getOauth_token(), authCallback.getAuthorization_code(), authCallback.getOauth_verifier()); - _logger.debug("Callback state {} ", - authCallback.getState() + _logger.debug("Callback state {} , sessionId {}", + authCallback.getState(),WebContext.getRequest().getSession().getId() ); authRequest=(AuthRequest)WebContext.getAttribute(SOCIALSIGNON_OAUTH_SERVICE_SESSION); @@ -124,13 +124,15 @@ public class AbstractSocialSignOnEndpoint { WebContext.removeAttribute(SOCIALSIGNON_PROVIDER_SESSION); if(authRequest == null) {//if authRequest is null renew one - authRequest=socialSignOnProviderService.getAuthRequest(provider,applicationConfig); - if(authCallback.getState() != null) { - authRequest.authorize(authCallback.getState()); - } - _logger.debug("session authRequest is null , renew one"); + authRequest=socialSignOnProviderService.getAuthRequest(provider,applicationConfig); + _logger.debug("session authRequest is null , renew one"); } + //State time out, re set + if(authCallback.getState() != null) { + authRequest.authorize(WebContext.getRequest().getSession().getId()); + } + AuthResponse authResponse=authRequest.login(authCallback); _logger.debug("Response : " + authResponse.getData()); accountId=socialSignOnProviderService.getAccountId(provider, authResponse); diff --git a/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/SocialSignOnEndpoint.java b/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/SocialSignOnEndpoint.java index 67c6b078..60a50c6a 100644 --- a/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/SocialSignOnEndpoint.java +++ b/maxkey-authentications/maxkey-authentication-social/src/main/java/org/maxkey/authn/support/socialsignon/SocialSignOnEndpoint.java @@ -115,11 +115,20 @@ public class SocialSignOnEndpoint extends AbstractSocialSignOnEndpoint{ } String state = request.getSession().getId(); authRequest.authorize(state); + SocialsProvider socialSignOnProvider = socialSignOnProviderService.get(provider); - socialSignOnProvider.setState(state); - socialSignOnProvider.setRedirectUri(applicationConfig.getServerPrefix()+ - "/logon/oauth20/callback/"+provider); - return socialSignOnProvider; + SocialsProvider scanQRCodeProvider = new SocialsProvider(); + + scanQRCodeProvider.setId(socialSignOnProvider.getId()); + scanQRCodeProvider.setProvider(socialSignOnProvider.getProvider()); + scanQRCodeProvider.setProviderName(socialSignOnProvider.getProviderName()); + scanQRCodeProvider.setState(state); + scanQRCodeProvider.setClientId(socialSignOnProvider.getClientId()); + scanQRCodeProvider.setRedirectUri(applicationConfig.getServerPrefix()+ + "/logon/oauth20/callback/"+provider); + scanQRCodeProvider.setAgentId(socialSignOnProvider.getAgentId()); + + return scanQRCodeProvider; } diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/resources/messages/message.properties b/maxkey-webs/maxkey-web-maxkey/src/main/resources/messages/message.properties index 67309d69..f7f40b02 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/resources/messages/message.properties +++ b/maxkey-webs/maxkey-web-maxkey/src/main/resources/messages/message.properties @@ -3,6 +3,7 @@ global.application=MaxKey\u7edf\u4e00\u8ba4 global.change.language=\u8bed\u8a00\u9009\u62e9 global.change.language.en=English global.change.language.zh=\u4e2d\u6587 +global.language=\u4e2d\u6587 global.text.welcome=\u6b22\u8fce\u60a8 global.text.manage=\u7ba1\u7406 global.text.copyright=\u7248\u6743\u6240\u6709 diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/resources/messages/message_en.properties b/maxkey-webs/maxkey-web-maxkey/src/main/resources/messages/message_en.properties index 888cebff..77686fc7 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/resources/messages/message_en.properties +++ b/maxkey-webs/maxkey-web-maxkey/src/main/resources/messages/message_en.properties @@ -3,6 +3,7 @@ global.application=MaxKey Single sign-on Sy global.change.language=Language global.change.language.en=English global.change.language.zh=\u4e2d\u6587 +global.language=English global.text.welcome=Welcome global.text.manage=Manage global.text.copyright=CopyRight diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/resources/messages/message_zh_CN.properties b/maxkey-webs/maxkey-web-maxkey/src/main/resources/messages/message_zh_CN.properties index 67309d69..f7f40b02 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/resources/messages/message_zh_CN.properties +++ b/maxkey-webs/maxkey-web-maxkey/src/main/resources/messages/message_zh_CN.properties @@ -3,6 +3,7 @@ global.application=MaxKey\u7edf\u4e00\u8ba4 global.change.language=\u8bed\u8a00\u9009\u62e9 global.change.language.en=English global.change.language.zh=\u4e2d\u6587 +global.language=\u4e2d\u6587 global.text.welcome=\u6b22\u8fce\u60a8 global.text.manage=\u7ba1\u7406 global.text.copyright=\u7248\u6743\u6240\u6709 diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/layout/nologintop.ftl b/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/layout/nologintop.ftl index 49314724..29d36bad 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/layout/nologintop.ftl +++ b/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/layout/nologintop.ftl @@ -10,21 +10,15 @@
- - - - - -
<@locale code="global.change.language"/> : - -
+
diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/loginworkweixin.ftl b/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/loginworkweixin.ftl index f8280241..642def69 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/loginworkweixin.ftl +++ b/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/loginworkweixin.ftl @@ -1,9 +1,9 @@ - +