|
@@ -125,9 +125,11 @@ public class SysUserFacade extends SysUserServiceImpl {
|
|
|
|
|
|
public void getCaptcha(HttpServletRequest request, HttpServletResponse response) throws IOException {
|
|
|
response.setContentType("image/png");
|
|
|
+ response.setHeader("Pragma", "no-cache");
|
|
|
+ response.setHeader("Cache-Control", "no-cache");
|
|
|
+ response.setDateHeader("Expires", 0);
|
|
|
HttpSession session = request.getSession();
|
|
|
String captchaId = session.getId();
|
|
|
- session.setAttribute("captchaId", captchaId);
|
|
|
ServletOutputStream outputStream = response.getOutputStream();
|
|
|
ImageCaptchaUtil imageCaptchaUtil = new ImageCaptchaUtil();
|
|
|
BufferedImage image = imageCaptchaUtil.createRandom();
|
|
@@ -145,7 +147,7 @@ public class SysUserFacade extends SysUserServiceImpl {
|
|
|
* @param password 密码
|
|
|
* @return jwt
|
|
|
*/
|
|
|
- public JwtDTO getJwt(HttpServletRequest request, String username, String password, String captcha) {
|
|
|
+ public JwtDTO getJwt(String username, String password) {
|
|
|
JwtDTO data = new JwtDTO();
|
|
|
if (StringUtil.isBlank(username)) {
|
|
|
throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
|
|
@@ -155,18 +157,6 @@ public class SysUserFacade extends SysUserServiceImpl {
|
|
|
throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
|
|
|
"请输入密码");
|
|
|
}
|
|
|
- if (StringUtils.isEmpty(captcha)) {
|
|
|
- throw new CommonException(CommonErrorCode.PARAM_IS_NULL,
|
|
|
- "请输入验证码");
|
|
|
- }
|
|
|
- // 验证码校验
|
|
|
- String captchaId = request.getSession().getId();
|
|
|
- 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对密码进行加密
|
|
|
String MD5Password = DigestUtils.md5DigestAsHex(password.getBytes());
|
|
|
QueryWrapper<SysUser> userQueryWrapper = new QueryWrapper<>();
|