diff --git a/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java b/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java index 39b007c78d..2eea36e2a5 100644 --- a/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java +++ b/epmet-auth/src/main/java/com/epmet/redis/CaptchaRedis.java @@ -42,9 +42,9 @@ public class CaptchaRedis { String captcha = (String)redisUtils.get(key); logger.info("获取验证码key=["+key+"]captcha=["+captcha+"]"); //删除验证码 - /* if(captcha != null){ + if(captcha != null){ redisUtils.delete(key); - }*/ + } return captcha; } diff --git a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java index 5ac8cf8650..b766131dcc 100644 --- a/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java +++ b/epmet-auth/src/main/java/com/epmet/service/impl/LoginServiceImpl.java @@ -215,12 +215,12 @@ public class LoginServiceImpl implements LoginService { */ @Override public Result loginByPassword(LoginByPassWordFormDTO formDTO) { - //验证码是否正确 - boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha()); + //1、验证码是否正确 + /*boolean flag = captchaService.validate(formDTO.getUuid(), formDTO.getCaptcha()); if(!flag){ return new Result().error(ErrorCode.CAPTCHA_ERROR); - } - //1、账号是否存在 + }*/ + //2、账号是否存在 //获取用户信息 PasswordLoginUserInfoFormDTO passwordLoginUserInfoFormDTO=new PasswordLoginUserInfoFormDTO(); passwordLoginUserInfoFormDTO.setApp(formDTO.getApp()); @@ -230,15 +230,12 @@ public class LoginServiceImpl implements LoginService { if(!userInfoResult.success()||null==userInfoResult.getData()){ return new Result().error("账号不存在"); } - //2、密码是否正确 + //3、密码是否正确 //密码错误 - if(!PasswordUtils.matches(userInfoResult.getData().getPassWord(), formDTO.getPassword())){ - throw new RenException(ErrorCode.ACCOUNT_PASSWORD_ERROR); - } - if(!userInfoResult.getData().getPassWord().equals(formDTO.getPassword())){ + if(!PasswordUtils.matches(formDTO.getPassword(),userInfoResult.getData().getPassWord())){ throw new RenException(ErrorCode.ACCOUNT_PASSWORD_ERROR); } - //3、生成token返回,且将TokenDto存到redis + //4、生成token返回,且将TokenDto存到redis UserTokenResultDTO userTokenResultDTO = new UserTokenResultDTO(); userTokenResultDTO.setToken(this.packagingUserToken(formDTO, userInfoResult.getData().getUserId())); return new Result().ok(userTokenResultDTO);