From b69983077a023111b6dd4b4dcd69e8324b3e57bc Mon Sep 17 00:00:00 2001 From: ZhouXY108 Date: Sun, 10 Sep 2023 16:47:30 +0800 Subject: [PATCH] =?UTF-8?q?plusone-validator=20=E4=BF=AE=E6=94=B9=E4=BA=86?= =?UTF-8?q?=E6=96=B9=E6=B3=95=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xyz/zhouxy/plusone/validatortest/BaseValidatorTest.java | 2 +- .../service/command/validator/LoginByOtpCommandValidator.java | 2 +- .../command/validator/LoginByPasswordCommandValidator.java | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/plusone-basic/plusone-basic-infrastructure/src/test/java/xyz/zhouxy/plusone/validatortest/BaseValidatorTest.java b/plusone-basic/plusone-basic-infrastructure/src/test/java/xyz/zhouxy/plusone/validatortest/BaseValidatorTest.java index b07aa1e..09896e0 100644 --- a/plusone-basic/plusone-basic-infrastructure/src/test/java/xyz/zhouxy/plusone/validatortest/BaseValidatorTest.java +++ b/plusone-basic/plusone-basic-infrastructure/src/test/java/xyz/zhouxy/plusone/validatortest/BaseValidatorTest.java @@ -36,7 +36,7 @@ class LoginCommandValidator extends BaseValidator { private LoginCommandValidator() { ruleForString(LoginCommand::getAccount) .notNull("邮箱地址不能为空") - .matchesOr(new Pattern[] { PatternConsts.EMAIL, PatternConsts.MOBILE_PHONE }, + .matchesOne(new Pattern[] { PatternConsts.EMAIL, PatternConsts.MOBILE_PHONE }, value -> new RuntimeException('"' + value + "\" 不是邮箱地址或手机号")); ruleForString(LoginCommand::getPwd) .notNull("密码不能为空") diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/validator/LoginByOtpCommandValidator.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/validator/LoginByOtpCommandValidator.java index 9117ff6..0fe2c15 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/validator/LoginByOtpCommandValidator.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/validator/LoginByOtpCommandValidator.java @@ -16,7 +16,7 @@ public class LoginByOtpCommandValidator extends BaseValidator ruleForString(LoginByOtpCommand::getPrincipal) .notNull("输入邮箱地址或手机号") .notEmpty("输入邮箱地址或手机号") - .matchesOr(List.of(PatternConsts.EMAIL, PatternConsts.MOBILE_PHONE), "输入用户名、邮箱地址或手机号"); + .matchesOne(List.of(PatternConsts.EMAIL, PatternConsts.MOBILE_PHONE), "输入用户名、邮箱地址或手机号"); ruleForString(LoginByOtpCommand::getOtp) .notNull("验证码不能为空") .notEmpty("验证码不能为空") diff --git a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/validator/LoginByPasswordCommandValidator.java b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/validator/LoginByPasswordCommandValidator.java index a97b506..7dd3cf3 100644 --- a/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/validator/LoginByPasswordCommandValidator.java +++ b/plusone-system/plusone-system-application/src/main/java/xyz/zhouxy/plusone/system/application/service/command/validator/LoginByPasswordCommandValidator.java @@ -15,7 +15,7 @@ public class LoginByPasswordCommandValidator extends BaseValidator