优化i18n

This commit is contained in:
zhou-hao
2021-06-25 10:54:58 +08:00
parent a59cbdac1c
commit 8b211de5e4
25 changed files with 306 additions and 88 deletions

View File

@@ -7,7 +7,6 @@ import org.hswebframework.web.authorization.annotation.TwoFactor;
import org.hswebframework.web.authorization.exception.NeedTwoFactorException;
import org.hswebframework.web.authorization.twofactor.TwoFactorValidator;
import org.hswebframework.web.authorization.twofactor.TwoFactorValidatorManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.method.HandlerMethod;
import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
@@ -45,7 +44,7 @@ public class TwoFactorHandlerInterceptorAdapter extends HandlerInterceptorAdapte
code = request.getHeader(factor.parameter());
}
if (StringUtils.isEmpty(code)) {
throw new NeedTwoFactorException("assert.need_two_factor_verify", factor.provider());
throw new NeedTwoFactorException("validation.need_two_factor_verify", factor.provider());
} else if (!validator.verify(code, factor.timeout())) {
throw new NeedTwoFactorException(factor.message(), factor.provider());
}

View File

@@ -34,7 +34,6 @@ import org.hswebframework.web.authorization.simple.PlainTextUsernamePasswordAuth
import org.hswebframework.web.logging.AccessLogger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.context.event.EventListener;
import org.springframework.http.MediaType;
import org.springframework.util.Assert;
import org.springframework.web.bind.annotation.*;
@@ -85,8 +84,8 @@ public class AuthorizationController {
String username_ = (String) parameters.get("username");
String password_ = (String) parameters.get("password");
Assert.hasLength(username_, "assert.username_must_not_be_empty");
Assert.hasLength(password_, "assert.password_must_not_be_empty");
Assert.hasLength(username_, "validation.username_must_not_be_empty");
Assert.hasLength(password_, "validation.password_must_not_be_empty");
Function<String, Object> parameterGetter = parameters::get;
return Mono.defer(() -> {