mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-06-02 10:57:49 +08:00
优化i18n
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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(() -> {
|
||||
|
||||
Reference in New Issue
Block a user