From 2d7c778d1f97e4157846eb3a797455a431ba7e51 Mon Sep 17 00:00:00 2001 From: ylyhappy <2778335106@qq.com> Date: Sun, 26 Mar 2023 18:44:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=AA=8C=E8=AF=81=E7=A0=81?= =?UTF-8?q?=E6=A0=A1=E9=AA=8C=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../carbon/config/security/filter/LoginFilter.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/CarbonSysBE1/src/main/java/edu/ncst/carbon/config/security/filter/LoginFilter.java b/CarbonSysBE1/src/main/java/edu/ncst/carbon/config/security/filter/LoginFilter.java index 2c00234..eca2c14 100644 --- a/CarbonSysBE1/src/main/java/edu/ncst/carbon/config/security/filter/LoginFilter.java +++ b/CarbonSysBE1/src/main/java/edu/ncst/carbon/config/security/filter/LoginFilter.java @@ -105,15 +105,16 @@ public class LoginFilter extends AbstractAuthenticationProcessingFilter {//OnceP // 校验验证码 String rightCaptcha = stringRedisTemplate.opsForValue().get("captcha:" + tempToken); String loginCaptcha = paramUserLoginVO.getLoginCaptcha(); -/* + if (loginCaptcha == null || "".equals(loginCaptcha)) { - throw new CaptchaIsEmptyException(CodeMsg.CAPTCHA_IS_NOT_RIGHT.getMsg()); + throw new BusinessException(CodeMsg.CAPTCHA_IS_EMPTY); } else if (rightCaptcha == null || "".equals(rightCaptcha)) { - throw new CaptchaIsExpiredException(CodeMsg.CAPTCHA_IS_EXPIRED.getMsg()); + throw new BusinessException(CodeMsg.CAPTCHA_IS_EXPIRED); } else if (!loginCaptcha.equalsIgnoreCase(rightCaptcha)) { - throw new CaptchaIsNotRightException(CodeMsg.CAPTCHA_IS_NOT_RIGHT.getMsg()); + throw new BusinessException(CodeMsg.CAPTCHA_IS_NOT_RIGHT); } - */ + + // 用户名密码登录,用户名可以是用户账号名、手机号或电子邮箱 UsernamePasswordAuthenticationToken token = new UsernamePasswordAuthenticationToken(paramUserLoginVO.getUsername(), paramUserLoginVO.getPassword());