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());