|
@@ -132,7 +132,7 @@ public class SysUserFacade extends SysUserServiceImpl {
|
|
|
ImageCaptchaUtil imageCaptchaUtil = new ImageCaptchaUtil();
|
|
|
BufferedImage image = imageCaptchaUtil.createRandom();
|
|
|
String captcha = imageCaptchaUtil.getText();
|
|
|
- redisUtils.set("user:captcha" + captchaId, captcha, 60 * 3);
|
|
|
+ redisUtils.set("user:captchaIds:" + captchaId, captcha, 60 * 3);
|
|
|
ImageIO.write(image, ImageCaptchaParams.DEFAULT_FORMAT, outputStream);
|
|
|
outputStream.flush();
|
|
|
outputStream.close();
|
|
@@ -161,9 +161,10 @@ public class SysUserFacade extends SysUserServiceImpl {
|
|
|
}
|
|
|
// 验证码校验
|
|
|
String captchaId = request.getSession().getId();
|
|
|
- Object captchaObject = redisUtils.get("user:captcha" + captchaId);
|
|
|
- redisUtils.del("user:captcha" + captchaId);
|
|
|
- if (null == captchaObject || StringUtils.isEmpty(captchaObject.toString()) || !captchaObject.toString().trim().equalsIgnoreCase(captcha)) {
|
|
|
+ Object captchaObject = redisUtils.get("user:captchaIds:" + captchaId);
|
|
|
+ if (null != captchaObject && StringUtil.isNotBlank(captchaObject.toString()) && captchaObject.toString().trim().equalsIgnoreCase(captcha)) {
|
|
|
+ redisUtils.del("user:captchaIds:" + captchaId);
|
|
|
+ }else{
|
|
|
throw new CommonException(CommonErrorCode.PARAM_IS_ERROR, "验证码错误");
|
|
|
}
|
|
|
//使用MD5对密码进行加密
|