fix(系统设置): LDAP登录提示信息国际化
--bug=1017678 --user=李玉号 【登录】密码输入错误,提示信息没有汉化 https://www.tapd.cn/55049933/s/1276612
This commit is contained in:
parent
7c2d529fdf
commit
6c9c780c85
|
@ -13,6 +13,7 @@ import io.metersphere.i18n.Translator;
|
||||||
import io.metersphere.ldap.service.SSLLdapContextSource;
|
import io.metersphere.ldap.service.SSLLdapContextSource;
|
||||||
import io.metersphere.request.LoginRequest;
|
import io.metersphere.request.LoginRequest;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.context.i18n.LocaleContextHolder;
|
||||||
import org.springframework.ldap.AuthenticationException;
|
import org.springframework.ldap.AuthenticationException;
|
||||||
import org.springframework.ldap.InvalidNameException;
|
import org.springframework.ldap.InvalidNameException;
|
||||||
import org.springframework.ldap.InvalidSearchFilterException;
|
import org.springframework.ldap.InvalidSearchFilterException;
|
||||||
|
@ -69,6 +70,9 @@ public class LdapService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public Optional<SessionUser> login(LoginRequest request, WebSession session, Locale locale) {
|
public Optional<SessionUser> login(LoginRequest request, WebSession session, Locale locale) {
|
||||||
|
if (locale != null) {
|
||||||
|
LocaleContextHolder.setLocale(locale, true);
|
||||||
|
}
|
||||||
String isOpen = service.getValue(ParamConstants.LDAP.OPEN.getValue());
|
String isOpen = service.getValue(ParamConstants.LDAP.OPEN.getValue());
|
||||||
if (StringUtils.isBlank(isOpen) || StringUtils.equals(Boolean.FALSE.toString(), isOpen)) {
|
if (StringUtils.isBlank(isOpen) || StringUtils.equals(Boolean.FALSE.toString(), isOpen)) {
|
||||||
MSException.throwException(Translator.get("ldap_authentication_not_enabled"));
|
MSException.throwException(Translator.get("ldap_authentication_not_enabled"));
|
||||||
|
|
Loading…
Reference in New Issue