| | |
| | | import java.util.Collection; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.regex.Matcher; |
| | | import java.util.regex.Pattern; |
| | | |
| | | /** |
| | | * 登录校验方法 |
| | |
| | | public void resetPwd(RegisterUser registerUser) { |
| | | User user = check(registerUser); |
| | | |
| | | String verifyKey = CacheConstants.PHONE_CODE_KEY + StringUtils.nvl(registerUser.getPhone(), ""); |
| | | String captcha = redisService.getCacheObject(verifyKey); |
| | | if (captcha == null) { |
| | | throw new CaptchaException("验证码错误"); |
| | | } |
| | | String[] split = captcha.split(":"); |
| | | |
| | | |
| | | long l = Long.parseLong(split[1]); |
| | | long l1 = System.currentTimeMillis(); |
| | | // 判断是否大于两分钟 |
| | | if (l1 - l > 2 * 60 * 1000) { |
| | | throw new CaptchaException("验证码已失效"); |
| | | } |
| | | captcha = split[0]; |
| | | if (!registerUser.getCode().equalsIgnoreCase(captcha)) { |
| | | throw new CaptchaException("验证码错误"); |
| | | } |
| | | |
| | | String password = SecurityUtils.encryptPassword(registerUser.getPassword()); |
| | | user.setPassword(password); |
| | | R<Void> r = remoteCompanyUserService.updateUser(user, SecurityConstants.INNER); |