From 6c9c780c85abb2b456687e45dff23f8f74c9ee47 Mon Sep 17 00:00:00 2001 From: shiziyuan9527 Date: Tue, 25 Oct 2022 16:10:44 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E7=B3=BB=E7=BB=9F=E8=AE=BE=E7=BD=AE):=20LD?= =?UTF-8?q?AP=E7=99=BB=E5=BD=95=E6=8F=90=E7=A4=BA=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=9B=BD=E9=99=85=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --bug=1017678 --user=李玉号 【登录】密码输入错误,提示信息没有汉化 https://www.tapd.cn/55049933/s/1276612 --- .../main/java/io/metersphere/gateway/service/LdapService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/framework/gateway/src/main/java/io/metersphere/gateway/service/LdapService.java b/framework/gateway/src/main/java/io/metersphere/gateway/service/LdapService.java index ef79baa773..9332b9ab33 100644 --- a/framework/gateway/src/main/java/io/metersphere/gateway/service/LdapService.java +++ b/framework/gateway/src/main/java/io/metersphere/gateway/service/LdapService.java @@ -13,6 +13,7 @@ import io.metersphere.i18n.Translator; import io.metersphere.ldap.service.SSLLdapContextSource; import io.metersphere.request.LoginRequest; import org.apache.commons.lang3.StringUtils; +import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.ldap.AuthenticationException; import org.springframework.ldap.InvalidNameException; import org.springframework.ldap.InvalidSearchFilterException; @@ -69,6 +70,9 @@ public class LdapService { } public Optional login(LoginRequest request, WebSession session, Locale locale) { + if (locale != null) { + LocaleContextHolder.setLocale(locale, true); + } String isOpen = service.getValue(ParamConstants.LDAP.OPEN.getValue()); if (StringUtils.isBlank(isOpen) || StringUtils.equals(Boolean.FALSE.toString(), isOpen)) { MSException.throwException(Translator.get("ldap_authentication_not_enabled"));