From 7df18a60b7631d1883d89d4036c4215947f7b089 Mon Sep 17 00:00:00 2001 From: zhou-hao Date: Thu, 24 Jan 2019 22:12:49 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8F=8C=E5=9B=A0=E5=AD=90?= =?UTF-8?q?=E9=AA=8C=E8=AF=81=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/authorization/annotation/TwoFactor.java | 7 +++++++ .../twofactor/TwoFactorHandlerInterceptorAdapter.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/TwoFactor.java b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/TwoFactor.java index 8b67380c4..ae03f13ad 100644 --- a/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/TwoFactor.java +++ b/hsweb-authorization/hsweb-authorization-api/src/main/java/org/hswebframework/web/authorization/annotation/TwoFactor.java @@ -49,4 +49,11 @@ public @interface TwoFactor { * @return 关闭验证 */ boolean ignore() default false; + + /** + * + * @return 错误提示 + * @since 3.0.6 + */ + String message() default "需要进行双因子验证"; } diff --git a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/twofactor/TwoFactorHandlerInterceptorAdapter.java b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/twofactor/TwoFactorHandlerInterceptorAdapter.java index db6fe085e..d1eea30c6 100644 --- a/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/twofactor/TwoFactorHandlerInterceptorAdapter.java +++ b/hsweb-authorization/hsweb-authorization-basic/src/main/java/org/hswebframework/web/authorization/basic/twofactor/TwoFactorHandlerInterceptorAdapter.java @@ -45,7 +45,7 @@ public class TwoFactorHandlerInterceptorAdapter extends HandlerInterceptorAdapte code = request.getHeader(factor.parameter()); } if (StringUtils.isEmpty(code)) { - throw new NeedTwoFactorException("需要进行双重验证", factor.provider()); + throw new NeedTwoFactorException(factor.message(), factor.provider()); } else if (!validator.verify(code, factor.timeout())) { throw new NeedTwoFactorException("验证码错误", factor.provider()); }